Skip to content

Commit fa0c0f4

Browse files
authored
ci: update of files from global .github repo (#1163)
1 parent 350392e commit fa0c0f4

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@ on:
1212
types:
1313
- created
1414

15+
permissions: {}
16+
1517
jobs:
1618
add-ready-to-merge-label:
19+
name: Add ready-to-merge label
20+
permissions:
21+
issues: write # required to add labels and post comments on PR issues
22+
pull-requests: write # required to read PR metadata from the issue pull_request URL
23+
contents: read # required to compare PR branch commits against base
1724
if: >
1825
github.event.issue.pull_request &&
1926
github.event.issue.state != 'closed' &&
@@ -30,6 +37,9 @@ jobs:
3037
env:
3138
GITHUB_ACTOR: ${{ github.actor }}
3239
with:
40+
# Use bot PAT, not the default GITHUB_TOKEN: events created by
41+
# GITHUB_TOKEN do not trigger other workflows, so `Automerge For
42+
# Humans` would never see the `labeled` event.
3343
github-token: ${{ secrets.GH_TOKEN }}
3444
script: |
3545
const prDetailsUrl = context.payload.issue.pull_request.url;
@@ -69,6 +79,10 @@ jobs:
6979
}
7080
7181
add-do-not-merge-label:
82+
name: Add do-not-merge label
83+
permissions:
84+
issues: write # required to add labels on PR issues
85+
pull-requests: write # required to read PR metadata from the issue pull_request URL
7286
if: >
7387
github.event.issue.pull_request &&
7488
github.event.issue.state != 'closed' &&
@@ -82,6 +96,7 @@ jobs:
8296
- name: Add do-not-merge label
8397
uses: actions/github-script@v7
8498
with:
99+
# Bot PAT so the `labeled` event can trigger downstream workflows.
85100
github-token: ${{ secrets.GH_TOKEN }}
86101
script: |
87102
github.rest.issues.addLabels({
@@ -91,6 +106,10 @@ jobs:
91106
labels: ['do-not-merge']
92107
})
93108
add-autoupdate-label:
109+
name: Add autoupdate label
110+
permissions:
111+
issues: write # required to add labels on PR issues
112+
pull-requests: write # required to read PR metadata from the issue pull_request URL
94113
if: >
95114
github.event.issue.pull_request &&
96115
github.event.issue.state != 'closed' &&
@@ -104,6 +123,7 @@ jobs:
104123
- name: Add autoupdate label
105124
uses: actions/github-script@v7
106125
with:
126+
# Bot PAT so the `labeled` event can trigger the autoupdate workflow.
107127
github-token: ${{ secrets.GH_TOKEN }}
108128
script: |
109129
github.rest.issues.addLabels({

0 commit comments

Comments
 (0)