From 7c74ffd16c44e46ec510e69f81fbebbd2f8dca10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Thu, 25 Apr 2024 11:51:02 +0200 Subject: [PATCH] CI: run actionlint --- .github/workflows/actionlint-exceptions.txt | 1 + .github/workflows/actionlint.yml | 44 +++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .github/workflows/actionlint-exceptions.txt create mode 100644 .github/workflows/actionlint.yml diff --git a/.github/workflows/actionlint-exceptions.txt b/.github/workflows/actionlint-exceptions.txt new file mode 100644 index 0000000000..3055b04595 --- /dev/null +++ b/.github/workflows/actionlint-exceptions.txt @@ -0,0 +1 @@ +.github/workflows/check-stylish-haskell.yml diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 0000000000..25a05cf9e3 --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,44 @@ +name: Actionlint + +on: + pull_request: + +jobs: + actionlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + # We want to install Nix to provision shellcheck, so that actionlint doesn't install + # its own shellcheck. This will also make sure that this pipeline runs using + # the same shellcheck as the ones in Nix shells of developers. + - 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: Install actionlint + run: | + # Puts the "actionlint" binary in the working folder + bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + + - name: Run Actionlint + run: | + for file in $(git ls-files ".github/workflows/*.y*ml") + do + if grep -q "$file" ".github/workflows/actionlint-exceptions.txt" + then + echo "⚠️ $file is ignored from actionlint's verifications. Please consider fixing it." + else + echo "./actionlint $file" + ./actionlint "$file" + fi + done