This simple github action will execute the provided code as a kotlin-main-kts script.
This is an alternative to the setup-kotlin optional script parameter, assuming kotlin is already installed (which is the default with ubuntu-latest).
Usage:
- uses: pgreze/kotlin-main-kts-run@v1
with:
script: |
println("Hello from kotlin")Why not just use
run:withshell: kotlin {0}?
Because run: code is stored in a random generated name,
but the kotlin compiler is expecting a filename suffixed with .main.kts
which is not possible without extra logic/steps.
This action is allowing a one-step declaration without hack.
Kotlin main kts runner is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.