Repository navigation
55 lines (51 loc) · 2.18 KB
/
Copy pathprops-bot-label.yml
File metadata and controls
55 lines (51 loc) · 2.18 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
47
48
49
50
51
52
53
54
55
name: Props Bot Label
on:
# Removing the label is what lets it be added again to ask for another
# refresh, so it lives apart from the gather: that one queues behind earlier
# runs, and the label should not wait on them to be consumed.
pull_request_target:
types:
- labeled
# A label added while the pull request could not be acted on is a
# request still waiting, so these consume it when it can be.
- ready_for_review
- reopened
# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}
jobs:
remove-label:
name: Remove the props-bot label
runs-on: 'ubuntu-slim'
permissions:
pull-requests: write
timeout-minutes: 5
# Matches the gather's own guard: removing the label on a draft would
# take away the request without anything acting on it.
if: |
(
github.event.action == 'labeled' && 'props-bot' == github.event.label.name ||
github.event.action != 'labeled' && contains( github.event.pull_request.labels.*.name, 'props-bot' )
) &&
! github.event.pull_request.draft && github.event.pull_request.state == 'open'
steps:
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
ISSUE_NUMBER: ${{ github.event.number }}
with:
retries: 2
retry-exempt-status-codes: 418
script: |
try {
await github.rest.issues.removeLabel( {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: process.env.ISSUE_NUMBER,
name: 'props-bot',
} );
} catch ( error ) {
// Someone removed it first, which is the same outcome.
if ( error.status !== 404 ) {
throw error;
}
}