Skip to content

feat(shellcheck): introduce shellcheck GH action - #64

Merged
Frzk merged 13 commits into
mainfrom
feat/shellcheck
Jun 10, 2026
Merged

feat(shellcheck): introduce shellcheck GH action#64
Frzk merged 13 commits into
mainfrom
feat/shellcheck

Conversation

@Frzk

@Frzk Frzk commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Frzk added 2 commits June 8, 2026 17:20
Comment thread shellcheck/action.yml Outdated
Co-authored-by: semgrep-code-scalingo[bot] <183740896+semgrep-code-scalingo[bot]@users.noreply.github.com>
Comment thread shellcheck/action.yml Outdated
Comment thread shellcheck/action.yml Outdated
Comment thread shellcheck/action.yml Outdated
As agreed during review.

Also adds support for:
- providing a list of files to scan (defaults to all .sh files)
- providing the severity to report
@Frzk
Frzk requested a review from EtienneM June 9, 2026 10:14
Comment thread shellcheck/action.yml Outdated
Comment thread shellcheck/action.yml Outdated
Comment thread shellcheck/action.yml Outdated
Comment thread shellcheck/action.yml
Comment thread shellcheck/action.yml Outdated
Frzk added 3 commits June 9, 2026 14:58
The 'runs.image' option only accept a static value.
koalaman/shellcheck is very minimal: it only contains the ShellCheck executable.
This allows to:
  - specify a ShellCheck version
  - integrates the 'actions/checkout' step
  - explicitely mounts the volume
Comment thread shellcheck/action.yml Outdated
@Frzk
Frzk requested a review from EtienneM June 9, 2026 14:14

@EtienneM EtienneM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few remaining questions/suggestion, but already approving

Comment thread shellcheck/action.yml Outdated
Comment thread shellcheck/action.yml Outdated
Comment on lines +52 to +53
--env FILES \
--env SEVERITY \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: are you sure ENV and FILES is how you can read the information from the environment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's the way to proceed :)

Comment thread shellcheck/action.yml Outdated
Comment on lines +57 to +79
sh -s <<'SCRIPT'

set -o errexit
set -o nounset"

cd "${GITHUB_WORKSPACE}"

if [ -n "${FILES}" ]; then
set --

while IFS= read -r file; do
[ -n "${file}" ] && set -- "$@" "${file}"
done <<EOF
${FILES}
EOF

shellcheck -S "${SEVERITY}" -s bash "$@"
else
find . -type f -name '*.sh' -not -path './.git/*' \
-exec shellcheck -S "${SEVERITY}" -s bash {} +
fi

SCRIPT

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I'm not keen on long scripts written like that. What do you think about adding this script in the shellcheck folder and calling it from here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahah, I was actually expecting/fearing this. I personally prefer to have it all in one file so I can have a clear view about what the action does.
But I'm also OK to put it in a separate file if you think it's clearer. It also allows to run it in another context 😃

It's been done in 29fdfb7 and fixed in 529e737

@Frzk
Frzk requested a review from EtienneM June 10, 2026 09:21

@EtienneM EtienneM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this :)

@Frzk
Frzk merged commit b230147 into main Jun 10, 2026
8 checks passed
@Frzk
Frzk deleted the feat/shellcheck branch June 10, 2026 12:29
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

Successfully merging this pull request may close these issues.

2 participants