Skip to content

Commit 56842da

Browse files
authored
Merge pull request #11802 from lucasssvaz/ci/pre-commit-comment
ci(pre-commit): Comment when fixes are needed
2 parents fdff7be + 507e7a9 commit 56842da

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/pre-commit-status.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,24 @@ jobs:
131131
gh pr edit ${{ steps.pr-info.outputs.pr_number }} --repo ${{ github.repository }} --remove-label 'Status: Pre-commit fixes required ⚠️'
132132
env:
133133
GH_TOKEN: ${{ github.token }}
134+
135+
- name: Comment on PR about pre-commit failures
136+
if: |
137+
steps.pr-info.outputs.artifacts_found == 'true' &&
138+
steps.pr-info.outputs.pre_commit_outcome == 'failure' &&
139+
steps.pr-info.outputs.pending_commit == '0'
140+
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
141+
with:
142+
pr-number: ${{ steps.pr-info.outputs.pr_number }}
143+
message: |
144+
## ⚠️ Pre-commit Hooks Failed
145+
146+
Some pre-commit hooks failed and require manual fixes. Please see the detailed error report below.
147+
148+
**What to do:**
149+
1. 📋 [**View the detailed error report**](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}) to see which hooks failed
150+
2. 🔧 Fix the issues locally in your code
151+
3. 💾 Commit and push your changes
152+
4. 🔄 The hooks will run again automatically
153+
154+
**Need help?** Ask in the comments below.

0 commit comments

Comments
 (0)