-
Notifications
You must be signed in to change notification settings - Fork 1.8k
34 lines (32 loc) · 1.09 KB
/
triage.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
name: Auto triage based on the component label in issue
on:
issues:
types: [opened, reopened, transferred]
jobs:
apply-label:
if: github.repository == 'opensearch-project/OpenSearch'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const { issue, repository } = context.payload;
const { number, body } = issue;
const { owner, name } = repository;
const regex = /###\sRelated\scomponent\n\n(\w.*)\n/gm;
let match;
while ( ( match = regex.exec( body ) ) ) {
const [ , component_label ] = match;
await github.rest.issues.addLabels( {
owner: owner.login,
repo: name,
issue_number: number,
labels: [ `${ component_label }` ],
} );
}
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['untriaged']
})