Skip to content

Add automation for Copilot reviews and auto-merge#932

Merged
kwannoel merged 1 commit intomainfrom
kwannoel/auto-review-workflows
Feb 3, 2026
Merged

Add automation for Copilot reviews and auto-merge#932
kwannoel merged 1 commit intomainfrom
kwannoel/auto-review-workflows

Conversation

@kwannoel
Copy link
Collaborator

@kwannoel kwannoel commented Feb 3, 2026

Description

Add a workflow that assigns Copilot to newly opened issues.

Related code PR

N/A

Related doc issue

N/A

Fix N/A

Checklist

  • I have run the documentation build locally to verify the updates are applied correctly.
  • For new pages, I have updated mint.json to include the page in the table of contents.
  • All links and references have been checked and are not broken.

assignees,
});
} catch (error) {
core.warning(`Unable to assign copilot: ${error.message}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the workflow will always succeed. How do we identify runs where an error actually occurred?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand if it fails, we should get a warning I suppose?

@yuhao-su
Copy link
Contributor

yuhao-su commented Feb 3, 2026

@codex review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces GitHub Actions automation around issue assignment, PR review requests, and automatic merging after review approval, to streamline Copilot-related workflows in this repo.

Changes:

  • Add a workflow to automatically request PR reviewers when a PR is opened, reopened, or marked ready for review.
  • Add a workflow that, on review approval, attempts to auto-approve pending workflow runs and then merge the PR.
  • Add a workflow that auto-assigns Copilot to new issues.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/request-pr-reviews.yml New workflow that triggers on PR events and uses actions/github-script to request a fixed set of reviewers, skipping the PR author.
.github/workflows/auto-merge-on-approval.yml New workflow that reacts to pull_request_review approvals, auto-approves pending workflow runs for maintainers, and then merges eligible PRs via the REST API.
.github/workflows/assign-copilot-issues.yml New workflow that assigns a copilot account to newly opened issues using actions/github-script.

Comment on lines +19 to +21
const requested = ["hzxa21", "tabVersion", "kwannoel"];
const author = context.payload.pull_request.user?.login;
const reviewers = requested.filter((login) => login && login !== author);
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description mentions that this workflow should request PR reviews "including Copilot", but the requested array here only contains these three user logins and does not include a Copilot account. Either add the Copilot reviewer here (if it has a GitHub login such as a bot/user account) or update the PR description to match the actual behavior.

Copilot uses AI. Check for mistakes.
Comment on lines +81 to +108
- name: Merge pull request
uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;

if (!pr || pr.state !== "open") {
core.info("Pull request is not open.");
return;
}

if (pr.draft) {
core.info("Pull request is draft.");
return;
}

if (pr.merged) {
core.info("Pull request already merged.");
return;
}

try {
await github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
merge_method: "merge",
});
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This merge step runs for any approved review without checking the reviewer’s repository permission level, so even a reviewer without admin/maintain/write access can cause the workflow (via GITHUB_TOKEN) to merge the PR. In addition, the merge happens immediately on approval without verifying that all required CI workflows have completed successfully, which can merge untested or failing code. Consider reusing the permission check from the previous step (or gating the job itself) and adding an explicit check that all required status checks have passed before calling github.rest.pulls.merge.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Copy link
Contributor

Copilot AI commented Feb 3, 2026

@kwannoel I've opened a new pull request, #933, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Collaborator Author

@kwannoel kwannoel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplified it a lot.

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.

5 participants