Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Fail if env variable is used in strategy of a job #573

Open
pdecat opened this issue Mar 20, 2021 · 4 comments
Open

Enhancement: Fail if env variable is used in strategy of a job #573

pdecat opened this issue Mar 20, 2021 · 4 comments
Assignees
Labels
area/workflow Relating to workflow definitions kind/bug Something isn't working needs-work Extra attention is needed stale-exempt Exempt from stale

Comments

@pdecat
Copy link

pdecat commented Mar 20, 2021

Describe feature

The following configuration works in act:

name: Python package

on: [push, pull_request]

env:
  target_python_version: 3.8

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 5
      matrix:
        python-version: [3.7, "${{env.target_python_version}}"]

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install tox tox-gh-actions
    - name: Test with tox
      run: tox

but fails in Github Actions:

.github/workflows/main.yml#L14The workflow is not valid. .github/workflows/main.yml (Line: 14, Col: 31): Unrecognized named-value: 'env'. Located at position 1 within expression: env.target_python_version

Sadly, this is not supported:

@pdecat pdecat added the kind/feature-request New feature or request label Mar 20, 2021
@pdecat pdecat changed the title Enhancement: Fail if env variable is used outside of job Enhancement: Fail if env variable is used outside of job step Mar 20, 2021
@pdecat pdecat changed the title Enhancement: Fail if env variable is used outside of job step Enhancement: Fail if env variable is used in strategy of a job step Mar 20, 2021
@pdecat pdecat changed the title Enhancement: Fail if env variable is used in strategy of a job step Enhancement: Fail if env variable is used in strategy of a job Mar 20, 2021
@github-actions
Copy link
Contributor

Issue is stale and will be closed in 14 days unless there is new activity

@github-actions github-actions bot added the stale label Apr 20, 2021
@catthehacker catthehacker added area/workflow Relating to workflow definitions kind/bug Something isn't working needs-work Extra attention is needed stale-exempt Exempt from stale and removed kind/feature-request New feature or request stale labels Apr 20, 2021
@catthehacker catthehacker self-assigned this May 6, 2021
@physikerwelt
Copy link

I am very new to act and github actions, so my assumption that my issue is related might be wrong. I am seeing at least the same error, if I try to skip an entire workflow locally.
https://github.com/zbMATHOpen/linksApi/blob/master/.github/workflows/codeql-analysis.yml#L27
I wonder if the is a different method people use to determine if the job is executed on github or locally.

@catthehacker
Copy link
Member

@physikerwelt you don't use environment variables in matrix so it's definitely not the same issue

@ZauberNerd
Copy link
Contributor

Check out https://github.com/rhysd/actionlint to lint your workflow files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/workflow Relating to workflow definitions kind/bug Something isn't working needs-work Extra attention is needed stale-exempt Exempt from stale
Projects
None yet
Development

No branches or pull requests

4 participants