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

Aperta
#1,685 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
github-actions, kotlin
Ambito
ci-cd

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

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")
Lingua principale
Kotlin
Stelle
664
Fork
30
Merge medio
4g 19h
PR unite (30g)
5

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di typesafegithub/github-workflows-kt

Tutte le issue di typesafegithub/github-workflows-kt

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.