Skip to content

How can we concatenate multiple env vars at workflow and job level? #26179

Answered by weide-zhou
adamrushuk asked this question in Actions
Discussion options

You must be logged in to vote

Hi @adamrushuk ,

The worklfow&job level env doesn’t support variable expression, hence cannot concatenate other workflow/job env vars. Currently it’s only supported for step level env.

You don’t need to repeat step level env definition, you can use ‘set-env’ to create and update env variable for any actions running next in a job. Code sample as below:

name: my workflow
on: push
env:
  MY_WORKFLOW_VAR: work
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Set env
      run: echo ::set-env name=STEPVAR::${{ env.MY_WORKFLOW_VAR }}-somestep
    - name: Test
      run: echo $STEPVAR

Thanks.

Replies: 2 comments

Comment options

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

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