Skip to content

Dynamically add inputs to Action #25353

Answered by BrightRan
jswny asked this question in Actions
Discussion options

You must be logged in to vote

@jswny,

You can try using the workflow command “set-env” to create or update an environment variable for any steps running next in a job. All the subsequent steps in the same job have access to the new value.
A simple demo:

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    env:
      MY_ENV: "env value 01"
    steps:
      - name: run action - 1st
        uses: actionOrg/actionRepo@master
        with:
          input: ${{ env.MY_ENV }}  # the input value is "env value 01"
  - name: update env
    run: echo "::set-env name=MY_ENV::env value 02"

  - name: run action - 2nd
    uses: actionOrg/actionRepo@master
    with:
      input: ${{ env.MY_ENV }}  # the input value is "env va…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants