typesafegithub / typesafegithub/github-workflows-kt

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

Open
#1,685 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Kotlin
Stars
664
Forks
30
Avg merge
4d 19h
Merged PRs (30d)
5

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked GitHub Actions inputs context documentation, then trace how Kotlin-based workflow steps currently expose context and environment data. Implement access matching the example inputs["myInput"] and verify that workflow inputs are available without the JSON environment workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, kotlin
Domain
ci-cd
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.