typesafegithub / typesafegithub/github-workflows-kt

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

Offen
#1,685 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

enhancement
Vorherrschende Sprache
Kotlin
Sterne
664
Forks
30
Ø Merge
4 T. 19 Std.
Gemergte PRs (30 T.)
5

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
github-actions, kotlin
Bereich
ci-cd
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.