forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (50 loc) · 1.98 KB
/
on-issue-labeled.yml
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
name: On Issue Labeled
# This workflow is triggered when a label is added to an issue.
on:
issues:
types: labeled
permissions:
contents: write
issues: write
jobs:
# Runs automatic checks on issues labeled with "Needs: Triage",
# then invokes actOnLabel to react to any added labels
triage-issue:
runs-on: ubuntu-latest
if: "${{ github.repository == 'facebook/react-native' && contains(github.event.label.name, 'Needs: Triage :mag:') }}"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Verify RN version
uses: actions/github-script@v6
with:
script: |
const verifyVersion = require('./.github/workflow-scripts/verifyVersion.js')
const labelWithContext = await verifyVersion(github, context);
if(labelWithContext && labelWithContext.label) {
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [labelWithContext.label]
})
const actOnLabel = require('./.github/workflow-scripts/actOnLabel.js')
await actOnLabel(github, context, labelWithContext)
}
- name: Add descriptive label
uses: actions/github-script@v6
with:
script: |
const addDescriptiveLabel = require('./.github/workflow-scripts/addDescriptiveLabels.js')
await addDescriptiveLabel(github, context);
# Reacts to the label that triggered this workflow (added manually or via other workflows)
act-on-label:
runs-on: ubuntu-latest
if: github.repository == 'facebook/react-native'
steps:
- uses: actions/checkout@v3
- uses: actions/github-script@v6
with:
script: |
const actOnLabel = require('./.github/workflow-scripts/actOnLabel.js')
await actOnLabel(github, context, {label: context.payload.label.name})