-
Notifications
You must be signed in to change notification settings - Fork 183
53 lines (47 loc) · 1.55 KB
/
auto_assign.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
name: Auto assign
on:
issues:
types: [opened]
jobs:
auto_assign:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout
- name: Randomly assign reviewers to community issues
uses: actions/github-script@v7
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
const fullTeam = [
"andyw8",
"dirceu",
"paracycle",
"vinistock",
"rafaelfranca",
"Morriar",
"st0012",
"egiurleo",
"KaanOzkan"
];
const author = "${{ github.event.issue.user.login }}";
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.issue.number }}
});
const hasNonVSCodeLabel = issue.data.labels.some(label => label.name === 'non-vscode');
if (!fullTeam.includes(author) && !hasNonVSCodeLabel) {
const dxReviewers = [
"andyw8",
"vinistock",
"st0012",
];
const assignee = dxReviewers[Math.floor(Math.random() * dxReviewers.length)];
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.issue.number }},
assignees: [assignee]
});
}