forked from internetarchive/openlibrary
-
Notifications
You must be signed in to change notification settings - Fork 2
46 lines (41 loc) · 1.27 KB
/
Copy pathpr_changes_requested.yml
File metadata and controls
46 lines (41 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Label PR When Changes Requested
on:
pull_request_review:
types: [submitted]
jobs:
label-changes-requested:
if: >
github.repository_owner == 'internetarchive' &&
github.event.review.state == 'changes_requested' &&
github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write # PRs are in the issues API so we need this too
steps:
- name: 'Add "Needs: Submitter Input" label'
uses: actions/github-script@v9
with:
script: |
const { owner, repo } = context.repo;
const issue_number = context.payload.pull_request.number;
// Add "Needs: Submitter Input"
await github.rest.issues.addLabels({
owner,
repo,
issue_number,
labels: ['Needs: Submitter Input'],
});
// Remove "Needs: Response" if present
try {
await github.rest.issues.removeLabel({
owner,
repo,
issue_number,
name: 'Needs: Response',
});
} catch (error) {
if (error.status !== 404) {
throw error;
}
}