Skip to content

Commit 3b1189d

Browse files
committed
Test
1 parent d52d99b commit 3b1189d

File tree

2 files changed

+42
-30
lines changed

2 files changed

+42
-30
lines changed
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Report Pre-commit Check Status
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened, synchronize, labeled, unlabeled]
6+
7+
permissions:
8+
statuses: write
9+
10+
jobs:
11+
report-run:
12+
name: Check if the PR has run the pre-commit checks
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Wait for pre-commit checks to complete
16+
uses: lucasssvaz/wait-on-workflow@v1
17+
id: wait-on-workflow
18+
with:
19+
workflow: pre-commit.yml
20+
sha: ${{ github.event.pull_request.head.sha || github.sha }}
21+
22+
- name: Report success
23+
if: |
24+
contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') &&
25+
steps.wait-on-workflow.outputs.conclusion == 'success'
26+
uses: conda/actions/[email protected]
27+
with:
28+
context: "Pre-commit checks"
29+
state: success
30+
description: All pre-commit checks passed
31+
32+
- name: Report pending
33+
if: |
34+
!contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') ||
35+
steps.wait-on-workflow.outputs.conclusion != 'success'
36+
uses: conda/actions/[email protected]
37+
with:
38+
context: "Pre-commit checks"
39+
state: pending
40+
description: The pre-commit checks need to be successful before merging

.github/workflows/pre-commit.yml

+2-30
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: Pre-commit check
22

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

77
jobs:
88
lint:
99
if: |
1010
contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge')
11-
name: Checking if any fixes are needed
11+
name: Check if fixes are needed
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout latest commit
@@ -60,31 +60,3 @@ jobs:
6060
if: always()
6161
with:
6262
msg: "ci(pre-commit): Apply automatic fixes"
63-
64-
report-run:
65-
name: Check if the PR has run the pre-commit checks
66-
permissions:
67-
statuses: write
68-
needs: lint
69-
if: always()
70-
runs-on: ubuntu-latest
71-
steps:
72-
- name: Report success
73-
if: |
74-
contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') &&
75-
needs.lint.result == 'success'
76-
uses: conda/actions/[email protected]
77-
with:
78-
context: pre-commit-result
79-
state: success
80-
description: All pre-commit checks passed
81-
82-
- name: Report pending
83-
if: |
84-
!contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') ||
85-
needs.lint.result == 'failure'
86-
uses: conda/actions/[email protected]
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)