Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow running arbitrary Kotlin code #136

Open
krzema12 opened this issue Mar 17, 2022 · 8 comments · Fixed by #1210
Open

Allow running arbitrary Kotlin code #136

krzema12 opened this issue Mar 17, 2022 · 8 comments · Fixed by #1210
Labels
enhancement New feature or request

Comments

@krzema12
Copy link
Member

No description provided.

@krzema12 krzema12 added the enhancement New feature or request label Mar 17, 2022
@krzema12
Copy link
Member Author

krzema12 commented Mar 27, 2022

@krzema12
Copy link
Member Author

@Vampire
Copy link
Collaborator

Vampire commented Jun 17, 2022

How about

run(
    // language=kotlin
    command = """
        println("Hello from action logic! (works already)")
    """.trimIndent(),
    _customArguments = mapOf(
        "shell" to StringCustomValue("kotlin -howtorun .main.kts {0}")
    )
)

?

@krzema12
Copy link
Member Author

@Vampire it's not ideal - no compile time verification of the Kotlin code, no syntax highlighting outside of IntelliJ. But yeah, what you showed is already something, even better if #286 is done. We could also have

runKotlin(
    // language=kotlin
    "println("Hello from action logic! (works already)")"
)

where runKotlin would have shell = "kotlin -howtorun .main.kts {0}" built-in + try to validate Kotlin code in workflow compile time. I'd go this way as first iteration and see how it works in practice.

@Vampire
Copy link
Collaborator

Vampire commented Jun 17, 2022

Maybe runMainKts to make it clear it runs as *.main.kts and you can for example use @Depends and so on.

@jmfayard
Copy link
Contributor

jmfayard commented Oct 11, 2022 via email

@krzema12 krzema12 self-assigned this Dec 25, 2023
@krzema12
Copy link
Member Author

Experimenting with a much simpler approach, WIP on https://github.com/typesafegithub/github-workflows-kt/tree/136-allow-putting-Kotlin-logic-in-lambda

@krzema12
Copy link
Member Author

krzema12 commented Jan 3, 2024

@krzema12 krzema12 reopened this Jan 3, 2024
@krzema12 krzema12 removed their assignment Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants