Job env variables cant be computed based on Workflow env variables
See original GitHub issueDescribe the bug
To Reproduce
name: Test Workflow Env Variables
on:
pull_request:
branches:
- main
push:
branches:
- main
env:
TEST: ${{ github.event_name == 'push' && 'A' || 'B' }}
jobs:
# verify if the workflow env variables are computed before job variables
job:
runs-on: ubuntu-latest
env:
COMPUTED_TEST: ${{ env.TEST }} # does not compile
steps:
- 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
Ubuntu-latest
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
N/A
Issue Analytics
- State:
- Created 5 months ago
- Comments:6 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Actually the runner get’s a list of environment 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.
However I don’t know if GitHub is planning to rewrite this part of the runner.
worker debug log
Worker_20230425-124108-utc.log
However not permitted by https://github.com/actions/languageservices/blob/main/workflow-parser/src/workflow-v1.0.json and it’s private copies across the github org.
Depends on the topic, this repository seem to be sometime more monitored than the discussions forum
Thank you