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

False positives on interpolated environment variable names #312

Closed
dgholz opened this issue Jun 19, 2023 · 1 comment
Closed

False positives on interpolated environment variable names #312

dgholz opened this issue Jun 19, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@dgholz
Copy link

dgholz commented Jun 19, 2023

I have a workflow like:

on: [push]

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
    - name: set output
      id: set-value
      run: |
        echo "value=key_name" >> "$GITHUB_OUTPUT"
    - name: use env var
      env:
        "${{ steps.set-value.outputs.value }}": ${{ github.repository_owner }}
      run: |
        echo "${${{ steps.set-value.outputs.value }}}"

(the actual workflow doesn't echo, it calls Bundler, which looks for environment variables with special formats to set config options)

This works fine when the workflow runs, but Actionlint reports

.github/workflows/test.yml:13:9: environment variable name "${{ steps.set-value.outputs.value }}" is invalid. '&', '=' and spaces should not be contained [env-var]
   |
13 |         "${{ steps.set-value.outputs.value }}": ${{ github.repository_owner }}
   |         ^~~~

Deleting the spaces resolves the false positive, but it reveals that Actionlint isn't handling the interpolation in the environment variable name.

@rhysd
Copy link
Owner

rhysd commented Jun 19, 2023

I didn't know that ${{ }} is available for environment variable names. Thanks for reporting this.

@rhysd rhysd added the bug Something isn't working label Jun 19, 2023
@rhysd rhysd closed this as completed in b7d1914 Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants