<#C02UUATR7RC|github-workflows-kt> just got a lot ...
# feed
p
#github-workflows-kt just got a lot more powerful! Now you can use Kotlin not only to define the structure of your workflow, but also to implement the logic of your steps. No more shell code inside strings (well, unless it's really simple). This feature is still experimental, especially its implementation. The performance is also a potential area of improvement. However, it unlocks so many possibilities that it's definitely worth exploring further. Waiting for your feedback!
🚀 8
👀 4
thank you color 2
😯 1
K 24
c
Wow, how did you implement that? Does it require Kotlin to be installed in whatever is running the steps?
p
> Wow, how did you implement that? The current implementation looks as follows: the workflow script (.main.kts) can be run in two modes. In the first one (the "main" one, and the only one so far) it generates the YAML. Then, if we have a step that wants to run some Kotlin logic, the step runs the very same script, but in a different mode. See an example YAML here. Using the env var, the script switches to the "run the Kotlin step" mode and thanks to the well-defined value of the env var, it knows which step from which job to run. I'm open to any other suggestions on how to implement it better. The current implementation has pros and cons, it's also a bit hacky given the API of the DSL. It was pretty simple to implement, so I went ahead with it 🙂 I'm especially interested in how Gradle works internally. > Does it require Kotlin to be installed in whatever is running the steps? Sure, but fortunately Kotlin comes preinstalled on the GitHub Actions workers anyway.
c
Oh, so the same script is used both to declare the orchestration and to run in a single step afterwards. That's quite clever.
🙌 1
Thanks for your answers, it's really interesting to see these kinds of features appear 🙂
p
sure thing! if you want to help further, feel free to give it a test drive whenever an opportunity arises 🙂
c
Thanks a lot for the offer 🙂 However, I am not a GitHub user. If I get some time in the future, I might attempt to build a similar thing for GitLab.
👍 1