Unify pre-commit actions and attempt to fix suggestion-bot (#3750)

This commit is contained in:
Richard Smith
2024-03-07 21:44:49 +00:00
committed by GitHub
parent 61ea4f8344
commit 648f0ccd78
3 changed files with 32 additions and 54 deletions
+12 -2
View File
@@ -6,6 +6,9 @@ name: pre-commit
on:
pull_request:
merge_group:
push:
branches: [trunk]
jobs:
pre-commit:
@@ -14,14 +17,21 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/action@v3.0.0
# We want to automatically create github suggestions for pre-commit file
# changes for a pull request. But `pull_request` actions never have write
# permissions to the repository, so we create the suggestions in a separate
# privileged `workflow_run` action in pre_commit_suggestions.yaml. Here,
# we upload the diffs and event configuration to an artifact for use by
# that action.
- name: Collect pre-commit output
if: ${{ failure() }}
if: failure()
run: |
mkdir -p pre-commit-output
git diff > pre-commit-output/diff
cp $GITHUB_EVENT_PATH pre-commit-output/event
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
if: failure()
with:
name: pre-commit output
path: pre-commit-output/*