Skip to content

[Core feature request] Add support to Workflow Dispatch Inputs #811

Open
@LeoColman

Description

@LeoColman

Discussed in Kotlin's Slack: https://app.slack.com/client/T09229ZC6/C02UUATR7RC/thread/C02UUATR7RC-1682902161.628869

What feature do you need?
Workflows Dispatch Inputs:
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs

Do you have an example usage?

https://github.com/kotest/kotest/blob/80bc809be1e0452dc1f3ee2e67aec2f6c7f6c251/.github/workflows/release_base.yml#L15


env:
   RELEASE_VERSION: ${{ inputs.version }}
   OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
   OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
   ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
   ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
   GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=false -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxMetaspaceSize=756m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"

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

Yes. One can use WorkflowDispatch normally, and use expr { github["event.inputs.XXXX"]!! } to get the value when they need it.

workflow(
  name = "Publish",
  on = listOf(
    WorkflowDispatch(
      mapOf("RELEASE_VERSION" to Input("The release version", true, String))
    )
  ),
  sourceFile = __FILE__.toPath(),
  env = linkedMapOf(
    "OSSRH_USERNAME" to expr { OSSRH_USERNAME },
    "OSSRH_PASSWORD" to expr { OSSRH_PASSWORD },
    "ORG_GRADLE_PROJECT_signingKey" to expr { ORG_GRADLE_PROJECT_signingKey },
    "ORG_GRADLE_PROJECT_signingPassword" to expr { ORG_GRADLE_PROJECT_signingPassword },
    "RELEASE_VERSION" to expr { github["event.inputs.version"]!! }
  )
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions