Skip to content

Commit 3738cdc

Browse files
committed
pythongh-127785: Reduce permissions in the check labels workflow (python#130596)
(cherry picked from commit 5ba69e7)
1 parent 630dc2b commit 3738cdc

File tree

1 file changed

+45
-6
lines changed

1 file changed

+45
-6
lines changed

.github/workflows/require-pr-label.yml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,57 @@ on:
55
types: [opened, reopened, labeled, unlabeled, synchronize]
66

77
jobs:
8-
label:
9-
name: DO-NOT-MERGE / unresolved review
8+
label-dnm:
9+
name: DO-NOT-MERGE
1010
if: github.repository_owner == 'python'
1111
runs-on: ubuntu-latest
1212
permissions:
13-
issues: write
14-
pull-requests: write
13+
pull-requests: read
1514
timeout-minutes: 10
1615

1716
steps:
18-
- uses: mheap/github-action-required-labels@v5
17+
- name: Check there's no DO-NOT-MERGE
18+
uses: mheap/github-action-required-labels@v5
1919
with:
2020
mode: exactly
2121
count: 0
22-
labels: "DO-NOT-MERGE, awaiting changes, awaiting change review"
22+
labels: |
23+
DO-NOT-MERGE
24+
25+
label-reviews:
26+
name: Unresolved review
27+
if: github.repository_owner == 'python'
28+
runs-on: ubuntu-latest
29+
permissions:
30+
pull-requests: read
31+
timeout-minutes: 10
32+
33+
steps:
34+
# Check that the PR is not awaiting changes from the author due to previous review.
35+
- name: Check there's no required changes
36+
uses: mheap/github-action-required-labels@v5
37+
with:
38+
mode: exactly
39+
count: 0
40+
labels: |
41+
awaiting changes
42+
awaiting change review
43+
- id: is-feature
44+
name: Check whether this PR is a feature (contains a "type-feature" label)
45+
uses: mheap/github-action-required-labels@v5
46+
with:
47+
mode: exactly
48+
count: 1
49+
labels: |
50+
type-feature
51+
exit_type: success # don't fail the check if the PR is not a feature, just record the result
52+
# In case of a feature PR, check for a complete review (contains an "awaiting merge" label).
53+
- id: awaiting-merge
54+
if: steps.is-feature.outputs.status == 'success'
55+
name: Check for complete review
56+
uses: mheap/github-action-required-labels@v5
57+
with:
58+
mode: exactly
59+
count: 1
60+
labels: |
61+
awaiting merge

0 commit comments

Comments
 (0)