diff --git a/.github/workflows/external-pr-review-assignment.yml b/.github/workflows/external-pr-review-assignment.yml new file mode 100644 index 00000000000..e96e157e8ce --- /dev/null +++ b/.github/workflows/external-pr-review-assignment.yml @@ -0,0 +1,32 @@ +name: Assign reviewers for external PRs + +on: + pull_request_target: + types: [opened, ready_for_review, reopened] + +permissions: + pull-requests: write + +jobs: + assign-reviewers: + # The 'if' statement below will exclude Dependabot PRs and internal PRs + if: > + github.actor != 'dependabot[bot]' && + !github.event.pull_request.draft && + github.event.pull_request.author_association != 'MEMBER' && + github.event.pull_request.author_association != 'OWNER' && + github.event.pull_request.author_association != 'COLLABORATOR' && + github.event.pull_request.head.repo.fork + runs-on: ubuntu-latest + # The job below will use the built-in "Request reviewers for a pull request" script to assign reviewers + steps: + - name: Assign reviewer from Bicep External Maintainers team + uses: actions/github-script@v7 + with: + script: | + await github.rest.pulls.requestReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + team_reviewers: ['bicep-external-maintainers'] + })