-
Notifications
You must be signed in to change notification settings - Fork 59
28 lines (25 loc) · 1 KB
/
assign-reviewers.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
name: Choose random assignees
on:
pull_request:
types: [opened, ready_for_review, reopened]
jobs:
test:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- name: Choose random assignees
run: |
# Skip PRs that have assignees already
gh pr view ${{ github.event.number }} --repo ${{ github.repository }} --json assignees \
| jq '.assignees | length > 0' -e && \
exit 0
chosen=$(perl \
-e 'use List::Util qw(shuffle head);' \
-e 'my @assignees = grep { "${{ github.event.sender.login }}" ne $_ } shuffle split /\s+/, $ENV{ASSIGNEES};' \
-e 'print join ",", head $ENV{NUM_ASSIGNEES}, @assignees' \
)
gh pr edit ${{ github.event.number }} --add-assignee $chosen --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ github.token }}
NUM_ASSIGNEES: 2
ASSIGNEES: jparr721 rob-maron ss-es bfish713 QuentinI shenkeyao lukaszrzasik lukeiannucci