add script to list changed files and do a branch diff #7
This file contains hidden or 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: Sh Lint | |
| on: | |
| push: | |
| paths: | |
| - "**.sh" | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| shell-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| - name: Set up python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --locked | |
| - name: Run shfmt | |
| run: | | |
| globalStatus=0 | |
| while IFS= read -r -d '' f; do | |
| if ! uv run shfmt --diff --indent 4 -- "$f"; then | |
| echo "[ERROR] shfmt failed for $f" | |
| globalStatus=1 | |
| fi | |
| done < <(find .hooks src -type f -name '*.sh' -print0) | |
| exit $globalStatus | |
| - name: Run shellcheck | |
| run: | | |
| globalStatus=0 | |
| while IFS= read -r -d '' f; do | |
| if ! uv run shellcheck --external-sources --exclude=SC2034 -- "$f"; then | |
| echo "[ERROR] shellcheck failed for $f" | |
| globalStatus=1 | |
| fi | |
| done < <(find .hooks src -type f -name '*.sh' -print0) | |
| exit $globalStatus |