mirror of
https://github.com/tw93/Mole.git
synced 2026-02-05 05:39:42 +00:00
49 lines
1.3 KiB
YAML
49 lines
1.3 KiB
YAML
name: Shell Script Quality Checks
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
shell-quality-checks:
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22.6'
|
|
|
|
- name: Install shell linting and testing tools
|
|
run: brew install bats-core shfmt shellcheck
|
|
|
|
- name: Auto-format shell scripts with shfmt
|
|
run: ./scripts/format.sh
|
|
|
|
- name: Run shellcheck linter and bats tests
|
|
run: ./scripts/check.sh
|
|
|
|
- name: Build Universal Binary for disk analyzer
|
|
run: ./scripts/build-analyze.sh
|
|
|
|
- name: Commit analyzer binary if updated
|
|
if: github.event_name != 'pull_request'
|
|
run: |
|
|
if git diff --quiet -- bin/analyze-go; then
|
|
echo "bin/analyze-go unchanged; nothing to commit."
|
|
exit 0
|
|
fi
|
|
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add bin/analyze-go
|
|
git commit -m "chore: update analyzer binary"
|
|
git push origin HEAD:${GITHUB_REF#refs/heads/}
|