Skip to content

Commit

Permalink
Merge pull request #734 from IntersectMBO/smelc/ci-add-shellcheck
Browse files Browse the repository at this point in the history
CI: run shellcheck
  • Loading branch information
smelc committed Apr 23, 2024
2 parents 9b4cd25 + 831722e commit 8736052
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/shellcheck-exceptions.txt
@@ -0,0 +1,2 @@
.github/bin/haddocks.sh
scripts/ci/check-cabal-files.sh
39 changes: 39 additions & 0 deletions .github/workflows/shellcheck.yml
@@ -0,0 +1,39 @@
name: Shellcheck
# This pipeline runs shellcheck on all files with extension .sh,
# except the ones listed in .github/workflows/shellcheck-exceptions.txt.
#
# This pipeline uses Nix, so that the shellcheck version used is the same
# ones as used by developers in Nix shells. This ensures the CI's behavior
# is consistent with the one of developers.

on:
pull_request:

jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix with good defaults
uses: input-output-hk/install-nix-action@v20
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
substituters = https://cache.iog.io/ https://cache.nixos.org/
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-unstable
# Make the Nix environment available to next steps
- uses: rrbutani/use-nix-shell-action@v1
- name: Shellcheck
run: |
for file in $(git ls-files "*.sh")
do
if grep -q "$file" ".github/workflows/shellcheck-exceptions.txt"
then
echo "⚠️ $file is ignored from shellcheck's verifications. Please consider fixing it."
else
shellcheck "$file"
fi
done

0 comments on commit 8736052

Please sign in to comment.