| 1 |
name: 📊 Static Checks |
| 2 |
on: |
| 3 |
workflow_call: |
| 4 |
workflow_dispatch: |
| 5 |
|
| 6 |
jobs: |
| 7 |
static-checks: |
| 8 |
name: Code style, file formatting, and docs |
| 9 |
runs-on: ubuntu-24.04 |
| 10 |
timeout-minutes: 30 |
| 11 |
steps: |
| 12 |
- name: Checkout |
| 13 |
uses: actions/checkout@v6 |
| 14 |
with: |
| 15 |
fetch-depth: 2 |
| 16 |
|
| 17 |
|
| 18 |
- name: .gitignore checks (gitignore_check.sh) |
| 19 |
run: | |
| 20 |
bash ./misc/scripts/gitignore_check.sh |
| 21 |
|
| 22 |
- name: Get changed files |
| 23 |
env: |
| 24 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 25 |
run: | |
| 26 |
if [ "${{ github.event_name }}" == "pull_request" ]; then |
| 27 |
files=$(git diff-tree --no-commit-id --name-only -r HEAD^1..HEAD 2> /dev/null || true) |
| 28 |
elif [ "${{ github.event_name }}" == "push" -a "${{ github.event.forced }}" == "false" -a "${{ github.event.created }}" == "false" ]; then |
| 29 |
files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }}..${{ github.event.after }} 2> /dev/null || true) |
| 30 |
fi |
| 31 |
files=$(echo "$files" | xargs -I {} sh -c 'echo "\"./{}\""' | tr '\n' ' ') |
| 32 |
echo "CHANGED_FILES=$files" >> $GITHUB_ENV |
| 33 |
|
| 34 |
- name: Style checks via prek |
| 35 |
uses: j178/prek-action@v2 |
| 36 |
with: |
| 37 |
extra-args: --files ${{ env.CHANGED_FILES }} |