From 75941cde04d6f433b95c9b6442c2be628a82f0e5 Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Fri, 5 Sep 2025 10:58:56 -0300 Subject: [PATCH 1/2] ci(pre-commit): Comment when fixes are needed --- .github/workflows/pre-commit-status.yml | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/pre-commit-status.yml b/.github/workflows/pre-commit-status.yml index 194ab1c8255..b5ec86fb4c6 100644 --- a/.github/workflows/pre-commit-status.yml +++ b/.github/workflows/pre-commit-status.yml @@ -131,3 +131,34 @@ jobs: gh pr edit ${{ steps.pr-info.outputs.pr_number }} --repo ${{ github.repository }} --remove-label 'Status: Pre-commit fixes required ⚠️' env: GH_TOKEN: ${{ github.token }} + + - name: Comment on PR about pre-commit failures + if: | + steps.pr-info.outputs.artifacts_found == 'true' && + steps.pr-info.outputs.pre_commit_outcome == 'failure' && + steps.pr-info.outputs.pending_commit == '0' + uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1 + with: + pr-number: ${{ steps.pr-info.outputs.pr_number }} + comment-tag: pre-commit-failure + message: | + ## ⚠️ Pre-commit Hooks Failed + + Some pre-commit hooks failed and require manual fixes. + + **What to do:** + 1. 🔧 Fix the issues locally in your code + 2. 💾 Commit and push your changes + 3. 🔄 The hooks will run again automatically + + [🔗 View detailed error log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}) + + - name: Remove pre-commit failure comment if resolved + if: | + steps.pr-info.outputs.artifacts_found == 'true' && + steps.pr-info.outputs.pre_commit_outcome == 'success' + uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1 + with: + pr-number: ${{ steps.pr-info.outputs.pr_number }} + comment-tag: pre-commit-failure + mode: delete From 507e7a98f02da8e44287614815f25e071846ba2e Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Fri, 5 Sep 2025 12:25:58 -0300 Subject: [PATCH 2/2] fix(pre-commit): Fix message and preserve comment --- .github/workflows/pre-commit-status.yml | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pre-commit-status.yml b/.github/workflows/pre-commit-status.yml index b5ec86fb4c6..afd52fdcb5e 100644 --- a/.github/workflows/pre-commit-status.yml +++ b/.github/workflows/pre-commit-status.yml @@ -140,25 +140,15 @@ jobs: uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1 with: pr-number: ${{ steps.pr-info.outputs.pr_number }} - comment-tag: pre-commit-failure message: | ## ⚠️ Pre-commit Hooks Failed - Some pre-commit hooks failed and require manual fixes. + Some pre-commit hooks failed and require manual fixes. Please see the detailed error report below. **What to do:** - 1. 🔧 Fix the issues locally in your code - 2. 💾 Commit and push your changes - 3. 🔄 The hooks will run again automatically + 1. 📋 [**View the detailed error report**](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}) to see which hooks failed + 2. 🔧 Fix the issues locally in your code + 3. 💾 Commit and push your changes + 4. 🔄 The hooks will run again automatically - [🔗 View detailed error log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}) - - - name: Remove pre-commit failure comment if resolved - if: | - steps.pr-info.outputs.artifacts_found == 'true' && - steps.pr-info.outputs.pre_commit_outcome == 'success' - uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1 - with: - pr-number: ${{ steps.pr-info.outputs.pr_number }} - comment-tag: pre-commit-failure - mode: delete + **Need help?** Ask in the comments below.