1
1
name : Pre-commit check
2
2
3
3
on :
4
- pull_request :
4
+ pull_request_target :
5
5
types : [opened, reopened, synchronize, labeled, unlabeled]
6
6
7
- permissions :
8
- statuses : write
9
-
10
7
jobs :
11
8
lint :
12
9
if : |
66
63
67
64
report-run :
68
65
name : Check if the PR has run the pre-commit checks
66
+ permissions :
67
+ statuses : write
69
68
needs : lint
70
69
if : always()
71
70
runs-on : ubuntu-latest
@@ -74,28 +73,18 @@ jobs:
74
73
if : |
75
74
contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') &&
76
75
needs.lint.result == 'success'
77
- uses : actions/github-script@v7
76
+ uses : conda/ actions/set-commit-status
78
77
with :
79
- script : |
80
- github.rest.repos.createCommitStatus({
81
- owner: context.repo.owner,
82
- repo: context.repo.repo,
83
- sha: ${{ github.event.pull_request.head.sha }},
84
- state: 'success',
85
- context: 'pre-commit-result',
86
- description: 'All pre-commit checks passed',
87
- });
78
+ context : pre-commit-result
79
+ state : success
80
+ description : All pre-commit checks passed
88
81
89
82
- name : Report pending
90
- env :
91
- GH_TOKEN : ${{ github.token }}
92
83
if : |
93
84
!contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') ||
94
85
needs.lint.result == 'failure'
95
- run : |
96
- gh api \
97
- --method POST \
98
- -H "Accept: application/vnd.github+json" \
99
- -H "X-GitHub-Api-Version: 2022-11-28" \
100
- /repos/${{ github.repository }}/statuses/${{ github.sha }} \
101
- -f state=pending -f context=pre-commit-result -f description="Pre-commit checks need to pass before merging"
86
+ uses : conda/actions/set-commit-status
87
+ with :
88
+ context : pre-commit-result
89
+ state : pending
90
+ description : The pre-commit checks need to be successful before merging
0 commit comments