Skip to content
award

GitHub Action

Kotlin main kts runner

v1 Latest version

Kotlin main kts runner

award

Kotlin main kts runner

Run the given code as a main.kts script

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Kotlin main kts runner

uses: pgreze/kotlin-main-kts-run@v1

Learn more about this action in pgreze/kotlin-main-kts-run

Choose a version

Kotlin main kts run

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")

FAQ

Why not just use run: with shell: 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.