Skip to content

Commit

Permalink
Don't assign people to drafts (#3605)
Browse files Browse the repository at this point in the history
* Don't assign people to drafts

* Fix PR author
  • Loading branch information
QuentinI authored Aug 23, 2024
1 parent ef49983 commit eee55bb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/assign-reviewers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ on:
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.actor }}" ne $_ } shuffle split /\s+/, $ENV{ASSIGNEES};' \
-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 }}
Expand Down

0 comments on commit eee55bb

Please sign in to comment.