Nikky
04/12/2022, 6:06 PMsourceFile = __FILE__.toPath(),
targetFile = __FILE__.resolveSibling(
__FILE__.name.substringBeforeLast(".main.kts") + ".yml"
).toPath(),
sadly this does not quite work out of the box..
working on a fix.. adding a parameter rootDirectory
(sounds clunky.. name suggestions?)
which is used to generate paths relative to rootDIrectory
so that will continues to work from whatever directory you invoke it ..
TL;DR the idea run script button should work with that change..
a default setup with the scripts and yml files in .github/workflows/
might look like so..
sourceFile = __FILE__.toPath(),
targetFile = __FILE__.toPath().resolveSibling(
__FILE__.name.substringBeforeLast(".main.kts") + ".yml"
),
rootDirectory = __FILE__.toPath().absolute().parent.parent.parent,
PS: i wish we could bake this logic into the library.. but __FILE__
is a magic constant that only exists in main.kts
scripts..Piotr Krzemiński
04/12/2022, 7:38 PM___FILE___
yet, but what I'm thinking about is a function that would accept ___FILE___
and the desired path, and do its magic there. PoC needed, then we'll see how it works in practice :) thanks for taking a look at it!Nikky
04/13/2022, 7:04 AMmain
what we need is the path to be relative to the repository root..
is the location of the yml files always in .github/workflows/
we could make that a default i guess..
and the user would only need to provide the filename of the yml
file (and that can also have a default)Nikky
04/13/2022, 7:08 AM.
) so it does not change api for anyone who does not care..Piotr Krzemiński
04/13/2022, 6:48 PMNikky
04/16/2022, 6:54 PMPiotr Krzemiński
04/16/2022, 8:03 PM