File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 6565 uses : tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1
6666
6767 - name : Run pre-commit hooks in changed files
68+ id : pre-commit
6869 run : pre-commit run --color=always --show-diff-on-failure --files ${{ steps.changed-files.outputs.all_changed_files }}
6970
7071 - name : Save pre-commit cache
8283 if : ${{ always() && github.event_name == 'pull_request' }}
8384 with :
8485 msg : " ci(pre-commit): Apply automatic fixes"
86+
87+ - name : Add label if no commits are pending
88+ if : ${{ failure() && steps.pre-commit.outcome == 'failure' && steps.pre-commit.outputs.pending_commit == '0' && github.event_name == 'pull_request' }}
89+ run : |
90+ gh pr edit ${{ github.event.number }} --add-label 'Status: Pre-commit fixes required ⚠️'
91+ env :
92+ GH_TOKEN : ${{ github.token }}
Original file line number Diff line number Diff line change @@ -108,3 +108,20 @@ repos:
108108 - id : vale
109109 language_version : " 1.23.2"
110110 types_or : [markdown, rst]
111+
112+ # Always leave this last to ensure that all hooks have already run
113+ - repo : local
114+ hooks :
115+ - id : git-diff
116+ name : git diff
117+ entry : |
118+ bash -c '
119+ if [ "$CI" = "true" ]; then
120+ if git diff --exit-code; then
121+ echo "pending_commit=0" >> $GITHUB_OUTPUT
122+ else
123+ echo "pending_commit=1" >> $GITHUB_OUTPUT
124+ fi
125+ fi
126+ '
127+ language : system
You can’t perform that action at this time.
0 commit comments