Skip to content

Instantly share code, notes, and snippets.

@cb109
Last active March 11, 2026 10:08
Show Gist options
  • Select an option

  • Save cb109/80094c9df65c753265fa29bd60edc419 to your computer and use it in GitHub Desktop.

Select an option

Save cb109/80094c9df65c753265fa29bd60edc419 to your computer and use it in GitHub Desktop.
chrome extension to automatically click "Request review from Copilot" for a new/existing PR

To create a PR and trigger a copilot review, first install the GitHub CLI on your machine, then also this extension to your browser, then do e.g.:

gh pr create --base master --head develop --title "my title" --body "" --label my-label
open "$(gh pr list --head develop --base master --json url -q '.[0].url')?copilot_review=1"
// Only trigger if URL contains ?copilot=1 or similar
if (
window.location.search.includes('copilot_review=true') ||
window.location.search.includes('copilot_review=1') ||
window.location.search.includes('copilot_review=on')
) {
const observer = new MutationObserver((mutations, obs) => {
// Request a review by Copilot
const requestReviewButton = document.querySelector('button.js-suggested-reviewer');
if (requestReviewButton) {
requestReviewButton.click();
console.log('Requested review from Copilot');
}
});
observer.observe(document.body, { childList: true, subtree: true });
setTimeout(() => {
observer.disconnect();
}, 5000);
// Request a PR summary by Copilot in the initial comment box.
// This is very brittle due to hardcoded wait times and unstable CSS selectors.
setTimeout(() => {
const firstCommentActions = document.querySelector('.timeline-comment-action');
if (firstCommentActions) {
firstCommentActions.click();
setTimeout(() => {
const editCommentButton = document.querySelector('.js-comment-edit-button');
if (editCommentButton) {
editCommentButton.click();
const copilotActionsMenu = document.querySelector('markdown-toolbar .octicon-copilot').parentElement;
if (copilotActionsMenu) {
copilotActionsMenu.click();
setTimeout(() => {
const generateSummaryOption = document.querySelector('div[data-component="AnchoredOverlay"] li:nth-child(1) ul li');
if (generateSummaryOption) {
generateSummaryOption.click();
console.log('Requested PR summary from Copilot');
}
}, 1000)
}
}
}, 1000);
}
}, 3000);
}
{
"manifest_version": 3,
"name": "GitHub Copilot Auto-Assign",
"version": "1.0",
"description": "Automatically clicks 'Assign Copilot' on GitHub PR pages when ?copilot_review=1 is in URL",
"permissions": ["tabs", "scripting"],
"content_scripts": [
{
"matches": ["https://github.com/*/*/pull/*"],
"js": ["background.js"],
"run_at": "document_idle"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment