rhysd / actionlint

:octocat: Static checker for GitHub Actions workflow files
https://rhysd.github.io/actionlint/
MIT License
2.74k stars 154 forks source link

Playground does not catch certain Shellcheck issues #364

Open stackptr opened 1 year ago

stackptr commented 1 year ago

With .github/workflows/test.yml:

name: Test workflow

on:
  push:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - run: |
          now="$(date +%s)"
          read -r -d '' req_json <<MALFORMED_EOF
          {
            "foo": "bar"
          }
                MALFORMED_EOF
          echo "$req_json"

Copying and pasting into the playground yields no issues in Safari or Chrome.

Running actionlint (via Nix) in CLI catches an issue with malformed here document:

shell ❯ actionlint .github/workflows/test.yml
.github/workflows/test.yml:10:9: shellcheck reported issue in this script: SC1009:info:2:1: The mentioned syntax error was in this simple command [shellcheck]
   |
10 |       - run: |
   |         ^~~~
.github/workflows/test.yml:10:9: shellcheck reported issue in this script: SC1073:error:2:24: Couldn't parse this here document. Fix to allow more checks [shellcheck]
   |
10 |       - run: |
   |         ^~~~
.github/workflows/test.yml:10:9: shellcheck reported issue in this script: SC1039:error:6:1: Remove indentation before end token (or use <<- and indent with tabs) [shellcheck]
   |
10 |       - run: |
   |         ^~~~
.github/workflows/test.yml:10:9: shellcheck reported issue in this script: SC1072:error:9:1: Here document was not correctly terminated. Fix any mentioned problems and try again [shellcheck]
   |
10 |       - run: |
   |         ^~~~

As far as I can tell, there is no configuration that actionlint is using locally that would explain these different outputs.

sondrelg commented 3 months ago

Another example, running v1.7.1 with pre-commit: https://github.com/snok/container-retention-policy/actions/runs/9641151530/job/26586217725. Not able to replicate these lints locally.

rhysd commented 3 months ago

This is a limitation of playground because shellcheck cannot run on browser. Playground runs actionlint via WASM on client side.

sondrelg commented 3 months ago

For my case, it was just that shellcheck is installed on github runners, and wasn't on my machine ✅

rhysd commented 3 months ago

Okay, so it is not related to this issue. Let me mark comments off-topic (including this).