question-mark
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.

Unrecognized named-value: 'env'. for job conditional

See original GitHub issue

Describe 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

Erroring Workflow

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:closed
  • Created 2 years ago
  • Reactions:33
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

60reactions
frameratecommented, Jul 14, 2022

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 😕

Read more comments on GitHub >

github_iconTop 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 >

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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found