ci: improve shellcheck job
1. Use env directive instead of adding to $GITHUB_ENV.
2. Use bash herefile to feed sha256sum instead of pipe to grep.
3. Fix the hardcoded checksum (it was missing the first character).
@@ -90,24 +90,23 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- - name: vars
- run: |
- echo 'VERSION=v0.8.0' >> $GITHUB_ENV
- echo 'BASEURL=https://github.com/koalaman/shellcheck/releases/download' >> $GITHUB_ENV
- echo 'SHA256SUM=f4bce23c11c3919c1b20bcb0f206f6b44c44e26f2bc95f8aa708716095fa0651' >> $GITHUB_ENV
- echo ~/bin >> $GITHUB_PATH
- name: install shellcheck
+ env:
+ VERSION: v0.8.0
+ BASEURL: https://github.com/koalaman/shellcheck/releases/download
+ SHA256: f4bce23c11c3919c1b20bcb0f206f6b44c44e26f2bc95f8aa708716095fa0651
run: |
mkdir ~/bin
curl -sSfL --retry 5 $BASEURL/$VERSION/shellcheck-$VERSION.linux.x86_64.tar.xz |
tar xfJ - -C ~/bin --strip 1 shellcheck-$VERSION/shellcheck
- sha256sum ~/bin/shellcheck | grep -q $SHA256SUM
+ sha256sum --strict --check - <<<"$SHA256 *$HOME/bin/shellcheck"
# make sure to remove the old version
sudo rm -f /usr/bin/shellcheck
+ # Add ~/bin to $PATH.
+ echo ~/bin >> $GITHUB_PATH
- uses: lumaxis/shellcheck-problem-matchers@v1
- - name: shellcheck
- run: |
- make shellcheck
+ - name: run
+ run: make shellcheck
- name: check-config.sh
run : ./script/check-config.sh
