diff options
| author | 2026-01-16 15:48:14 +0800 | |
|---|---|---|
| committer | 2026-01-16 15:48:14 +0800 | |
| commit | 15439e41644a17b4ef889e78474025d54ac4b6c7 (patch) | |
| tree | a5dbe63e0efde1ce7273683c55398e46d95678c3 /.github | |
| parent | cffc1cad8584c770de94dff87d519d1304f647d5 (diff) | |
| download | DropOut-15439e41644a17b4ef889e78474025d54ac4b6c7.tar.gz DropOut-15439e41644a17b4ef889e78474025d54ac4b6c7.zip | |
chore: enhance prek workflow to support auto-fixing and commit changes
Updated the GitHub Actions workflow to enable automatic fixes for issues detected by the prek action. Added a conditional step to commit changes made by prek, improving the CI process by ensuring that fixes are applied directly to the repository.
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/prek.yml | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/.github/workflows/prek.yml b/.github/workflows/prek.yml index 094ebf9..88c9be3 100644 --- a/.github/workflows/prek.yml +++ b/.github/workflows/prek.yml @@ -3,20 +3,35 @@ name: Prek Checks on: push: branches: ["main", "dev"] - pull_request: - branches: ["main", "dev"] workflow_dispatch: permissions: - contents: read + contents: write jobs: prek: runs-on: ubuntu-latest + # Skip if commit message contains [skip ci] (to avoid loops with pre-commit.ci) + if: "!contains(github.event.head_commit.message, '[skip ci]')" steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 - - name: Run prek + - name: Run prek (auto-fix) + id: prek uses: j178/prek-action@v1 + continue-on-error: true + with: + all_files: true + + - name: Commit fixes + if: steps.prek.outcome == 'failure' + uses: stefanzweifel/git-auto-commit-action@v5 with: - all_files: ${{ github.event_name == 'pull_request' }} + commit_message: "chore: apply prek auto-fixes [skip ci]" + commit_user_name: "pre-commit bot" + commit_user_email: "pre-commit-bot@users.noreply.github.com" + skip_dirty_check: true |