Skip to content

Can workflow_dispatch inputs be enhanced to set INPUT_* environmental variables? #25924

Answered by BrightRan
dogboydog asked this question in Actions
Discussion options

You must be logged in to vote

@dogboydog,

Yes, currently GitHub does not automatically create environment variables for the inputs of the ‘workflow_dispatch’ trigger.

If you want to use the inputs as environment variables in the workflow, you can set the inputs as the workflow global environment variables via the ‘env’ key.
For example:

on:
  workflow_dispatch:
    inputs:
      log_Level:
        description: 'Log level'
        required: true
        default: 'warning'

env:
INPUT_LOG_LEVEL: ${{ github.event.inputs.log_Level }}

jobs:
job1:
runs-on: ubuntu-latest
steps:
- name: Print input
run: echo "The log level is $INPUT_LOG_LEVEL"

However, as mentioned in the docs, you also need to note that:

When more than one …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
2 replies
@Yarden-zamir
Comment options

@dogboydog
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants