From fc419b6a3fff9e95063e6cb7dc9a694861497a36 Mon Sep 17 00:00:00 2001 From: cori Date: Sat, 13 Jun 2026 13:19:30 +0000 Subject: [PATCH 1/2] Add Copilot review + auto-merge workflow Fanned in from claude-code-base (branch claude/great-clarke-fpor65) to exercise the workflow here, where PR traffic is heavier. Co-Authored-By: Claude Opus 4.7 --- .github/workflows/copilot-review.yml | 102 +++++++++++++++++++++++++++ 1 file changed, 102 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..159eb36 --- /dev/null +++ b/.github/workflows/copilot-review.yml @@ -0,0 +1,102 @@ +name: Copilot review and auto-merge + +on: + pull_request: + types: [opened, ready_for_review] + pull_request_review: + types: [submitted] + +permissions: + contents: read + +jobs: + request-copilot-review: + if: github.event_name == 'pull_request' && github.event.pull_request.draft == false + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Request Copilot review + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OWNER: ${{ github.repository_owner }} + NAME: ${{ github.event.repository.name }} + PR_NODE_ID: ${{ github.event.pull_request.node_id }} + run: | + # Copilot can't be requested via the REST `requested_reviewers` + # endpoint (it rejects non-collaborators). Use the GraphQL + # `suggestedActors` lookup to find Copilot's bot id, then call + # `requestReviews`. This mirrors GitHub's official MCP behavior. + copilot_id=$(gh api graphql \ + -F owner="$OWNER" \ + -F name="$NAME" \ + -f query=' + query($owner: String!, $name: String!) { + repository(owner: $owner, name: $name) { + suggestedActors(capabilities: [CAN_BE_ASSIGNED], first: 100) { + nodes { + login + ... on Bot { id } + ... on User { id } + } + } + } + } + ' \ + --jq '[.data.repository.suggestedActors.nodes[] | select(.login == "Copilot" or .login == "copilot-pull-request-reviewer") | .id] | first // ""') + + if [ -z "$copilot_id" ]; then + echo "::warning::Copilot reviewer not available on this repo. Enable Copilot code review in repo settings." + exit 0 + fi + + gh api graphql \ + -F pullRequestId="$PR_NODE_ID" \ + -F userId="$copilot_id" \ + -f query=' + mutation($pullRequestId: ID!, $userId: ID!) { + requestReviews(input: {pullRequestId: $pullRequestId, userIds: [$userId]}) { + pullRequest { id } + } + } + ' + + auto-merge-on-clean-copilot-review: + if: >- + github.event_name == 'pull_request_review' && + github.event.review.user.login == 'copilot-pull-request-reviewer[bot]' && + github.event.pull_request.draft == false + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Decide whether Copilot requested any changes + id: check + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + PR: ${{ github.event.pull_request.number }} + REVIEW_ID: ${{ github.event.review.id }} + REVIEW_STATE: ${{ github.event.review.state }} + run: | + if [ "$REVIEW_STATE" = "changes_requested" ]; then + echo "Copilot requested changes; skipping auto-merge." + echo "merge=false" >> "$GITHUB_OUTPUT" + exit 0 + fi + inline_count=$(gh api "repos/$REPO/pulls/$PR/reviews/$REVIEW_ID/comments" --jq 'length') + if [ "$inline_count" -gt 0 ]; then + echo "Copilot left $inline_count inline comment(s); skipping auto-merge." + echo "merge=false" >> "$GITHUB_OUTPUT" + else + echo "Copilot review is clean; enabling auto-merge." + echo "merge=true" >> "$GITHUB_OUTPUT" + fi + - name: Enable auto-merge + if: steps.check.outputs.merge == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + PR: ${{ github.event.pull_request.number }} + run: gh pr merge "$PR" --repo "$REPO" --squash --auto From d1e070554e977a4e252e774dc9bdb895539cede2 Mon Sep 17 00:00:00 2001 From: cori schlegel <46317+cori@users.noreply.github.com> Date: Sun, 14 Jun 2026 06:42:22 -0500 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/copilot-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/copilot-review.yml b/.github/workflows/copilot-review.yml index 159eb36..1454abc 100644 --- a/.github/workflows/copilot-review.yml +++ b/.github/workflows/copilot-review.yml @@ -43,7 +43,7 @@ jobs: } } ' \ - --jq '[.data.repository.suggestedActors.nodes[] | select(.login == "Copilot" or .login == "copilot-pull-request-reviewer") | .id] | first // ""') + --jq '[.data.repository.suggestedActors.nodes[] | select(.login == "Copilot" or .login == "Copilot[bot]" or .login == "copilot-pull-request-reviewer" or .login == "copilot-pull-request-reviewer[bot]") | .id] | first // ""') if [ -z "$copilot_id" ]; then echo "::warning::Copilot reviewer not available on this repo. Enable Copilot code review in repo settings."