Skip to content

[Core feature request] Access workflow inputs in Kotlin-based step #1685

@krzema12

Description

@krzema12

What feature do you need?
https://docs.github.com/en/enterprise-cloud@latest/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#inputs-context

The access could be even type-unsafe for now (just strings).

Do you have an example usage?

run {
    println(inputs["myInput"])
}

Is there a workaround for not having this feature? If yes, please describe it.

I'm currently doing something pretty ugly:

            val githubContextJson = System.getenv("GHWKT_GITHUB_CONTEXT_JSON")!!
            val version: String = Json.parseToJsonElement(githubContextJson)
                .jsonObject["event"]
                ?.jsonObject?.get("inputs")
                ?.jsonObject?.get("version")
                ?.jsonPrimitive?.contentOrNull
                ?: error("Version couldn't be extracted from input")

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions