From 2b395354b8213dca814d68d8bbf57c2d3f99110c Mon Sep 17 00:00:00 2001 From: Fazle Elahee Date: Tue, 19 May 2026 19:20:48 +0100 Subject: [PATCH 1/2] ci: auto-request Copilot review on PR open --- .github/workflows/copilot-review.yml | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/copilot-review.yml diff --git a/.github/workflows/copilot-review.yml b/.github/workflows/copilot-review.yml new file mode 100644 index 0000000..48af1ca --- /dev/null +++ b/.github/workflows/copilot-review.yml @@ -0,0 +1,29 @@ +name: Request Copilot review + +on: + pull_request: + types: [opened, ready_for_review] + +permissions: + pull-requests: write + contents: read + +jobs: + request-copilot-review: + if: ${{ !github.event.pull_request.draft }} + runs-on: ubuntu-latest + steps: + - name: Request review from Copilot + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + REPO: ${{ github.repository }} + run: | + gh api graphql -f query=' + mutation($pullRequestId: ID!, $userIds: [ID!]!) { + requestReviews(input: {pullRequestId: $pullRequestId, userIds: $userIds, union: true}) { + pullRequest { number } + } + }' \ + -f pullRequestId="$(gh api repos/$REPO/pulls/$PR_NUMBER --jq .node_id)" \ + -f userIds[]="BOT_kgDOC9w8XQ" From a7eca5a44c1e1a0de8f0899cdf9234fa974795c0 Mon Sep 17 00:00:00 2001 From: Fazle Elahee Date: Tue, 19 May 2026 19:22:54 +0100 Subject: [PATCH 2/2] ci: use REST requested_reviewers endpoint with Copilot login --- .github/workflows/copilot-review.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/copilot-review.yml b/.github/workflows/copilot-review.yml index 48af1ca..8c973fc 100644 --- a/.github/workflows/copilot-review.yml +++ b/.github/workflows/copilot-review.yml @@ -19,11 +19,9 @@ jobs: PR_NUMBER: ${{ github.event.pull_request.number }} REPO: ${{ github.repository }} run: | - gh api graphql -f query=' - mutation($pullRequestId: ID!, $userIds: [ID!]!) { - requestReviews(input: {pullRequestId: $pullRequestId, userIds: $userIds, union: true}) { - pullRequest { number } - } - }' \ - -f pullRequestId="$(gh api repos/$REPO/pulls/$PR_NUMBER --jq .node_id)" \ - -f userIds[]="BOT_kgDOC9w8XQ" + gh api \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + "repos/$REPO/pulls/$PR_NUMBER/requested_reviewers" \ + -f 'reviewers[]=Copilot' \ + || echo "Copilot review request failed — check org Copilot seat config."