-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
58 lines (50 loc) · 1.75 KB
/
Copy pathaction.yml
File metadata and controls
58 lines (50 loc) · 1.75 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
56
57
58
name: 'Toggle label'
description: 'Toggle a label on a pull request'
inputs:
token:
description: 'GitHub token to use. If passed, takes precedence over the `app-id` and `app-private-key` inputs.'
app-id:
description: 'The app ID of the app.'
private-key:
description: 'The private key of the app.'
label:
description: 'The label to toggle'
required: true
toggle:
description: 'Whether to add or remove the label.'
default: 'auto'
runs:
using: composite
steps:
- uses: myparcelnl/actions/get-github-token@v4
id: token
with:
token: ${{ inputs.token }}
app-id: ${{ inputs.app-id }}
private-key: ${{ inputs.private-key }}
- name: 'Add label'
uses: actions/github-script@v7
if: (inputs.toggle == 'true' || inputs.toggle == 'auto') && !contains(github.event.pull_request.labels.*.name, '${{ inputs.label }}')
with:
github-token: ${{ steps.token.outputs.token }}
#language=javascript
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['${{ inputs.label }}']
});
- name: 'Remove label'
uses: actions/github-script@v7
if: (inputs.toggle == 'false' || inputs.toggle == 'auto') && contains(github.event.pull_request.labels.*.name, '${{ inputs.label }}')
with:
github-token: ${{ steps.token.outputs.token }}
#language=javascript
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['${{ inputs.label }}']
});