Auto-commit: 0 added, 2 modified, 0 deleted #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Cache shellcheck and shfmt | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/tools | ||
key: ${{ runner.os }}-shell-tools | ||
restore-keys: | | ||
${{ runner.os }}-shell-tools | ||
on: | ||
push: | ||
branches: [ main, master ] | ||
pull_request: | ||
branches: [ main, master ] | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install shellcheck | ||
run: | | ||
sudo pacman -Su shellcheck --noconfirm | ||
mkdir -p ~/tools && cp $(which shellcheck) ~/tools | ||
- name: Install shfmt | ||
run: | | ||
wget https://github.com/mvdan/sh/releases/download/v3.4.1/shfmt_v3.4.1_linux_amd64 -O shfmt | ||
chmod +x shfmt | ||
sudo mv shfmt /usr/local/bin/ | ||
cp /usr/local/bin/shfmt ~/tools | ||
- name: Run shfmt | ||
run: | | ||
shfmt -l -w . | ||
git config --global user.email "you@example.com" | ||
git config --global user.name "Your Name" | ||
git add . | ||
git commit -m "Automated code formatting" || echo "No changes to commit" | ||
- name: Run shellcheck | ||
run: | | ||
scripts=$(find . -type f -name "*.sh") | ||
for script in $scripts; do | ||
shellcheck "$script" | ||
done |