Skip to content

Commit af6ef15

Browse files
committed
Test
1 parent 2a7332c commit af6ef15

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

.github/workflows/pre-commit.yml

+12-23
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
name: Pre-commit check
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [opened, reopened, synchronize, labeled, unlabeled]
66

7-
permissions:
8-
statuses: write
9-
107
jobs:
118
lint:
129
if: |
@@ -66,6 +63,8 @@ jobs:
6663

6764
report-run:
6865
name: Check if the PR has run the pre-commit checks
66+
permissions:
67+
statuses: write
6968
needs: lint
7069
if: always()
7170
runs-on: ubuntu-latest
@@ -74,28 +73,18 @@ jobs:
7473
if: |
7574
contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') &&
7675
needs.lint.result == 'success'
77-
uses: actions/github-script@v7
76+
uses: conda/actions/set-commit-status
7877
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
8881

8982
- name: Report pending
90-
env:
91-
GH_TOKEN: ${{ github.token }}
9283
if: |
9384
!contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') ||
9485
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

Comments
 (0)