ci: Add PR comment and failure handling for pre-commit checks

This commit is contained in:
Andreas Koepf (aider) 2025-01-31 00:02:10 +01:00
parent cb8d372912
commit 3e01b7dccf

View file

@ -13,3 +13,19 @@ jobs:
with:
python-version: '3.11'
- uses: pre-commit/action@v3.0.0
id: precommit
continue-on-error: true
- name: Comment on PR if pre-commit failed
if: steps.precommit.outcome == 'failure'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '❌ Pre-commit checks failed. Please run `pre-commit run --all-files` locally and fix the issues.'
})
- name: Exit with pre-commit status
if: steps.precommit.outcome == 'failure'
run: exit 1