diff --git a/.github/workflows/copilot-review.yml b/.github/workflows/copilot-review.yml new file mode 100644 index 000000000..4ed226a2f --- /dev/null +++ b/.github/workflows/copilot-review.yml @@ -0,0 +1,27 @@ +name: Request Copilot review + +on: + pull_request_target: + types: [opened, reopened, ready_for_review] + +permissions: + pull-requests: write + +jobs: + request-copilot-review: + if: >- + github.event.pull_request.draft == false && + contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) + runs-on: ubuntu-latest + steps: + - name: Request Copilot review + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPO: ${{ github.repository }} + run: | + gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + "/repos/${REPO}/pulls/${PR_NUMBER}/requested_reviewers" \ + -f "reviewers[]=Copilot"