Skip to content

Conversation

Copy link

Copilot AI commented Dec 20, 2025

Copilot PRs automatically assign the repository owner as reviewer despite Copilot code review being enabled via rulesets. This creates unnecessary overhead and prevents automatic merging.

Changes

  • Created .github/workflows/auto-dismiss-reviewer.yml
    • Triggers on PR open and review requests from copilot-swe-agent[bot]
    • Removes GhostwheeI from reviewers
    • Requests Copilot review via @copilot review comment
    • Enables auto-merge (squash) once checks pass
    • Explicit permissions: pull-requests: write, contents: read

Workflow behavior

on:
  pull_request:
    types: [opened, review_requested]

jobs:
  dismiss-reviewer:
    if: github.actor == 'copilot-swe-agent[bot]'
    permissions:
      pull-requests: write
      contents: read

Prerequisites

Repository settings must have "Allow auto-merge" enabled (Settings → General → Allow auto-merge).

Original prompt

Problem

When the Copilot coding agent creates pull requests, it automatically assigns the repository owner (GhostwheeI) as a reviewer. This is unnecessary overhead since Copilot code review is already enabled via rulesets. Additionally, PRs should auto-merge once all checks pass.

Solution

Create a GitHub Actions workflow that:

  1. Triggers when a PR is opened or a review is requested
  2. Only runs for PRs created by copilot-swe-agent[bot]
  3. Removes GhostwheeI from the reviewers list
  4. Requests Copilot code review by commenting @copilot review
  5. Enables auto-merge (squash) so the PR merges automatically once all checks pass

Implementation

Create the file .github/workflows/auto-dismiss-reviewer.yml with the following content:

name: Auto-dismiss owner from Copilot PRs

on:
  pull_request:
    types: [opened, review_requested]

jobs:
  dismiss-reviewer:
    runs-on: ubuntu-latest
    if: github.actor == 'copilot-swe-agent[bot]'
    steps:
      - name: Remove owner and request Copilot review
        uses: actions/github-script@v7
        with:
          script: |
            const owner = context.repo.owner;
            const repo = context.repo.repo;
            const pull_number = context.payload.pull_request.number;
            
            // Remove GhostwheeI as reviewer
            try {
              await github.rest.pulls.removeRequestedReviewers({
                owner,
                repo,
                pull_number,
                reviewers: ['GhostwheeI']
              });
              console.log(`Removed GhostwheeI from reviewers on PR #${pull_number}`);
            } catch (e) {
              console.log(`Could not remove reviewer: ${e.message}`);
            }
            
            // Request Copilot code review
            await github.rest.issues.createComment({
              owner,
              repo,
              issue_number: pull_number,
              body: '@copilot review'
            });
            console.log(`Requested Copilot review on PR #${pull_number}`);
            
            // Enable auto-merge (squash)
            try {
              await github.graphql(`
                mutation($pullRequestId: ID!) {
                  enablePullRequestAutoMerge(input: {
                    pullRequestId: $pullRequestId,
                    mergeMethod: SQUASH
                  }) {
                    pullRequest {
                      autoMergeRequest {
                        enabledAt
                      }
                    }
                  }
                }
              `, {
                pullRequestId: context.payload.pull_request.node_id
              });
              console.log(`Enabled auto-merge on PR #${pull_number}`);
            } catch (e) {
              console.log(`Could not enable auto-merge: ${e.message}`);
            }

Note

Make sure "Allow auto-merge" is enabled in repository settings (Settings → General → Allow auto-merge) for the auto-merge feature to work.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 20, 2025 07:25
Co-authored-by: GhostwheeI <155011637+GhostwheeI@users.noreply.github.com>
Co-authored-by: GhostwheeI <155011637+GhostwheeI@users.noreply.github.com>
Copilot AI changed the title [WIP] Create workflow to auto-dismiss owner from Copilot PRs Add workflow to auto-dismiss owner from Copilot PRs and enable auto-merge Dec 20, 2025
Copilot AI requested a review from GhostwheeI December 20, 2025 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants