1212 types :
1313 - created
1414
15+ permissions : {}
16+
1517jobs :
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' &&
20- github.actor != 'asyncapi-bot' &&
27+ github.event.comment.user.login != 'asyncapi-bot' &&
2128 (
2229 contains(github.event.comment.body, '/ready-to-merge') ||
2330 contains(github.event.comment.body, '/rtm' )
@@ -26,10 +33,13 @@ jobs:
2633 runs-on : ubuntu-latest
2734 steps :
2835 - name : Add ready-to-merge label
29- uses : actions/github-script@v7
36+ uses : actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
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,19 +79,24 @@ 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' &&
75- github.actor != 'asyncapi-bot' &&
89+ github.event.comment.user.login != 'asyncapi-bot' &&
7690 (
7791 contains(github.event.comment.body, '/do-not-merge') ||
7892 contains(github.event.comment.body, '/dnm' )
7993 )
8094 runs-on : ubuntu-latest
8195 steps :
8296 - name : Add do-not-merge label
83- uses : actions/github-script@v7
97+ uses : actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # 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,19 +106,24 @@ 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' &&
97- github.actor != 'asyncapi-bot' &&
116+ github.event.comment.user.login != 'asyncapi-bot' &&
98117 (
99118 contains(github.event.comment.body, '/autoupdate') ||
100119 contains(github.event.comment.body, '/au' )
101120 )
102121 runs-on : ubuntu-latest
103122 steps :
104123 - name : Add autoupdate label
105- uses : actions/github-script@v7
124+ uses : actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # 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