@@ -13,8 +13,8 @@ concurrency:
13
13
cancel-in-progress : true
14
14
15
15
permissions :
16
- contents : write
17
- pull-requests : read
16
+ contents : read
17
+ pull-requests : write
18
18
19
19
jobs :
20
20
lint :
34
34
- name : Remove Label
35
35
if : contains(github.event.pull_request.labels.*.name, 'Re-trigger Pre-commit Hooks')
36
36
run : gh pr edit ${{ github.event.number }} --remove-label 'Re-trigger Pre-commit Hooks'
37
+ continue-on-error : true
37
38
env :
38
39
GH_TOKEN : ${{ github.token }}
39
40
65
66
uses : tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1
66
67
67
68
- name : Run pre-commit hooks in changed files
69
+ id : pre-commit
68
70
run : pre-commit run --color=always --show-diff-on-failure --files ${{ steps.changed-files.outputs.all_changed_files }}
69
71
70
72
- name : Save pre-commit cache
82
84
if : ${{ always() && github.event_name == 'pull_request' }}
83
85
with :
84
86
msg : " ci(pre-commit): Apply automatic fixes"
87
+
88
+ - name : Add label if no commits are pending
89
+ if : ${{ failure() && steps.pre-commit.outcome == 'failure' && steps.pre-commit.outputs.pending_commit == '0' && github.event_name == 'pull_request' }}
90
+ continue-on-error : true
91
+ run : |
92
+ gh pr edit ${{ github.event.number }} --add-label 'Status: Pre-commit fixes required ⚠️'
93
+ env :
94
+ GH_TOKEN : ${{ github.token }}
95
+
96
+ - name : Remove label if everything was fixed
97
+ if : ${{ success() && github.event_name == 'pull_request' }}
98
+ continue-on-error : true
99
+ run : |
100
+ gh pr edit ${{ github.event.number }} --remove-label 'Status: Pre-commit fixes required ⚠️'
101
+ env :
102
+ GH_TOKEN : ${{ github.token }}
103
+
0 commit comments