actionlint icon indicating copy to clipboard operation
actionlint copied to clipboard

Question: different `shellcheck` behaviors?

Open jenstroeger opened this issue 2 years ago • 0 comments

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?

jenstroeger avatar Sep 02 '23 08:09 jenstroeger