-
Notifications
You must be signed in to change notification settings - Fork 305
42 lines (42 loc) · 1.4 KB
/
assign-issues.yaml
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
name: Agent Assignment
on:
issues:
types:
- opened
jobs:
auto-assign-label:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Get Team Members
id: team-members
env:
frontLine: ${{ vars.FRONT_LINE_USERS_LIST }}
#TODO - Temporary solution - team member configuration should be dynamic
run: |
echo "::set-output name=members::$frontLine"
- name: Get Next Team Member
id: next-member
run: |
members=($(echo "${{ steps.team-members.outputs.members }}" | tr ',' '\n'))
index=$(( (${GITHUB_RUN_NUMBER}-1) % ${#members[@]} ))
next_member=${members[$index]}
echo "::set-output name=next_member::$next_member"
- name: Add Open Label and Assign to Next Team Member
uses: actions/github-script@v4
with:
script: |
github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['Status: Open']
})
github.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: [`${{ steps.next-member.outputs.next_member}}`]
})
github-token: ${{ secrets.GITHUB_TOKEN }}