-
Notifications
You must be signed in to change notification settings - Fork 29
51 lines (45 loc) · 1.8 KB
/
issue_labelAndAssign.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
# The script consists of several steps:
# 1. define module keyword patterns, the designated label and assignee
# 2. define operating system keyword patterns, and the designated label
# 3. get the info about the issue
# 4. check if module keyword pattern matches text in the issue,
# looping over all patterns:
# - if pattern is found, label the issue, and assign the maintainer
# - if the pattern is not found, check if the label or assignee for the pattern
# is attached to the issue and remove them
# 5. do 4 but with OS keyword patterns
# so far this workflow works best with the bug_template.
# some resources: https://github.com/actions/github-script
# https://octokit.github.io/rest.js/v19
# https://docs.github.com/en/rest
name: Label and Assign
on:
issues:
types:
- opened
- reopened
jobs:
Bug-label-and-assign:
runs-on: ubuntu-latest
if: ${{ contains(github.event.issue.labels.*.name, 'Bug') }}
steps:
- uses: actions/checkout@v3
- uses: actions/github-script@v6
with:
script: |
const keyFun = require('./.github/scripts/keywords.js');
const keywords = keyFun();
const script = require('./.github/scripts/bug_labelAssign.js');
script({github, context}, keywords);
Feature-label-and-assign:
runs-on: ubuntu-latest
if: ${{ contains(github.event.issue.labels.*.name, 'Feature Request') }}
steps:
- uses: actions/checkout@v3
- uses: actions/github-script@v6
with:
script: |
const keyFun = require('./.github/scripts/keywords.js');
const keywords = keyFun();
const script = require('./.github/scripts/feature_labelAssign.js');
script({github, context}, keywords);