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

Question: different shellcheck behaviors? #347

Open
jenstroeger opened this issue Sep 2, 2023 · 0 comments
Open

Question: different shellcheck behaviors? #347

jenstroeger opened this issue Sep 2, 2023 · 0 comments

Comments

@jenstroeger
Copy link

Hello, thank you for a great tool!

Today I noticed a puzzling behavior with the shellcheck integration for run:. Suppose this workflow:

name: Test
on:
  pull_request:
    branches:
    - '*'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - shell: bash
      run: |
        pushd bla
        ls -la

then actionlint — without any other configuration — comes back clean:

> actionlint 
>

However, if I then copy the run: script into a separate shell script:

#! /bin/bash

pushd bla
ls -la

and run shellcheck then I get this:

> shellcheck test.sh

In test.sh line 3:
pushd bla
^-------^ SC2164 (warning): Use 'pushd ... || exit' or 'pushd ... || return' in case pushd fails.

Did you mean: 
pushd bla || exit

For more information:
  https://www.shellcheck.net/wiki/SC2164 -- Use 'pushd ... || exit' or 'pushd...
>

The warning here is different from the ones documented

To avoid errors due to the syntax, SC1091, SC2050, SC2194, SC2154, SC2157 are disabled.

This is for the latest version of actionlint:

> actionlint --version
1.6.25
installed by downloading from release page
built with go1.20.5 compiler for darwin/amd64

What’s happening here? Am I missing a configuration option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant