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

[Bug] Expression substitution doesn't always work #113

Closed
roryabraham opened this issue Feb 17, 2022 · 3 comments
Closed

[Bug] Expression substitution doesn't always work #113

roryabraham opened this issue Feb 17, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@roryabraham
Copy link

roryabraham commented Feb 17, 2022

From https://github.com/rhysd/actionlint/blob/main/docs/checks.md#shellcheck-integration-for-run:

Since both ${{ }} expression syntax and ShellScript's variable access $FOO use $, remaining ${{ }} confuses shellcheck. To avoid it, actionlint replaces ${{ }} with underscores. For example echo '${{ matrix.os }}' is replaced with echo '________________'.

Unfortunately, I found an example where this doesn't work:

run: |
  if [[ -z ${{ env.FOO }} ]]; then
    echo "FOO is empty"
  fi
@roryabraham
Copy link
Author

roryabraham commented Feb 17, 2022

Found a workaround but it's not ideal:

run: |
  SOME_VAR=${{ env.FOO }}
  if [[ -z "$FOO" ]]; then
    echo "FOO is empty"
  fi

@rhysd rhysd added the bug Something isn't working label Apr 13, 2022
@rhysd
Copy link
Owner

rhysd commented Apr 13, 2022

Thank you for reporting this. Really nice catch. I will temporarily disable SC2157 then consider how to handle this correctly later.

@rhysd
Copy link
Owner

rhysd commented Apr 13, 2022

I added workaround at 29512f4. Closing.

@rhysd rhysd closed this as completed Apr 13, 2022
rhysd added a commit that referenced this issue Apr 13, 2022
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