constellation/.github/workflows/assign_reviewer.yml
Daniel Weiße 1514351571
ci: update conditions on when to auto assign reviewer (#3141)
* Use the correct value for `github.event.pull_request.requested_reviewers`
* Run the workflow on more events than just labeling a PR
* Skip workflow if there are already reviewers assigned

---------

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
2024-06-05 08:42:47 +02:00

37 lines
1.1 KiB
YAML

name: Assign Reviewer
on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize
- review_request_removed
- labeled
permissions:
pull-requests: write
jobs:
assign_reviewer:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'dependencies') && toJson(github.event.pull_request.requested_reviewers) == '[]' && github.event.pull_request.user.login == 'renovate[bot]'
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Pick assignee
id: pick-assignee
uses: ./.github/actions/pick_assignee
- name: Assign reviewer
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.number }}
ASSIGNEE: ${{ steps.pick-assignee.outputs.assignee }}
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/edgelesssys/constellation/pulls/${PR}/requested_reviewers" \
-f "reviewers[]=${ASSIGNEE}"