Unrecognized named-value: 'env'. for job conditional
See original GitHub issueDescribe the bug
Use of env
in job conditionals causes an invalid config. Cross posting this from nektos/act#720
Expected behaviour
GitHub Actions should not error regarding ${{ !env.ACT }}
Actual behaviour
GitHub Actions says workflow is not valid because of ${{ !env.ACT }}
The workflow is not valid. .github/workflows/deploy.yml (Line: 11, Col: 13): Unrecognized named-value: 'env'. Located at position 2 within expression: !env.ACT
Workflow and/or repository
workflow
name: Deploy
on:
push:
branches:
- release
# run for every pull request
pull_request: {}
jobs:
deploy:
name: Deploy
if: ${{ !env.ACT }} # skip during local actions testing
runs-on: ubuntu-latest
strategy:
matrix:
node: [12]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false
- name: Deploy
run: npx semantic-release@15
Issue Analytics
- State:
- Created 2 years ago
- Reactions:33
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Environment variables in github actions
The error Unrecognized named-value: 'env' is telling you that GitHub is not recognizing the YAML you wrote at line 13. It's a syntax...
Read more >github actions conditional environment variables
My workaround for this environment variable setup was to utilize a ternary operator styled approach within the env stage at a global level....
Read more >Passing values between steps in Github Actions
This creates an environment variable called TERMINUS_RELEASE that is accessible by any step after this one either directly within a script ( $ ......
Read more >Runtime Variables in GitHub Actions
In scope: We will scope this to injecting a single environment variable into a pipeline, with a previously known key and value. Out...
Read more >Skipping Jobs in GitHub Actions when Secrets are ...
How to securely inject configuration secrets into GitHub and make GitHub action jobs conditional based on the presence of a secret.
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 FreeTop 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
Top GitHub Comments
Base on https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#context-availability
env
context is not available tojob.if
You can create feature request at https://github.community/c/code-to-cloud/github-actions/41
Well I wasted a few dollars of minutes and a few hours of my day based on that sentence so whether or not everyone gets confused by it I can say with certainty I got confused and frustrated by it.
Whether or not anyone wants to fix it is beyond the scope of my authority but enough of these frustrations in the documentation and I’ll surely go back to circleci for my CI 😕