Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Job env variables cant be computed based on Workflow env variables

See original GitHub issue

Describe the bug image

To Reproduce

name: Test Workflow Env Variables

      - main
      - main

  TEST: ${{ github.event_name == 'push' && 'A' || 'B' }}


  # verify if the workflow env variables are computed before job variables
    runs-on: ubuntu-latest
      COMPUTED_TEST: ${{ env.TEST }} # does not compile
      - run: |
          echo ${{ env.COMPUTED_TEST }}
          echo $COMPUTED_TEST

Expected behavior Job env variables should be determined based on Workflow env variables.

Considering the above workflow, the output on pull_request events should be B, and for push events A

Runner Version and Platform


What’s not working?

Job env variables cant be computed based on Workflow env variables

Job Log Output

It is in the image above

Runner and Worker’s Diagnostic Logs


Issue Analytics

  • State:closed
  • Created 5 months ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

ChristopherHXcommented, Apr 25, 2023

Actually the runner get’s a list of environment blocks.

  • workflow env
  • job env
  • (the list can technically contain more env blocks)

And are evaluated sequentially.

I just tested sending your job via my tool (via a relaxed workflow schema) to the actions/runner and it works.

##[group]Run echo A
echo A
shell: /usr/bin/bash -e {0}

However I don’t know if GitHub is planning to rewrite this part of the runner.

worker debug log


However not permitted by and it’s private copies across the github org.

which is actively monitored

Depends on the topic, this repository seem to be sometime more monitored than the discussions forum

AllanOricilcommented, Apr 25, 2023

Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workflow level env does not work properly in all fields. #480
When using workflow level environment variables they do not work when I use ... Job env variables cant be computed based on Workflow...
Read more >
Define Workflow Level Environment Variable Between Jobs
I'd like to define and set environment variable between jobs inside my Github Actions Workflow. The workflow below is what I've tried but ......
Read more >
Creating a job scoped computed environment variable in ...
A lot of the time we want to set a few environment variables scoped at the job level within a workflow. Variables scoped...
Read more >
Use environment variables | Workflows
All environment variables are bound to a deployment of a workflow, and can only be set or changed with a deployment. Creating or...
Read more >
How to Manage GitHub Actions Environment Variables and ...
The code below shows that when you place the environment variable in a particular job, other jobs cannot reference the environment variable.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found