Skip to content

Instantly share code, notes, and snippets.

@linuswillner
Last active April 17, 2025 13:18
Show Gist options
  • Save linuswillner/e806b6c21cdb5af13ef99a65fda1074d to your computer and use it in GitHub Desktop.
Save linuswillner/e806b6c21cdb5af13ef99a65fda1074d to your computer and use it in GitHub Desktop.
Declutter your GitHub pull requests by hiding reviews from Copilot
// ==UserScript==
// @name Hide GitHub Copilot reviews
// @description Declutter GitHub pull requests by hiding reviews from Copilot
// @version 2
// @namespace https://github.com/*/*/pull/*
// @include https://github.com/*/*/pull/*
// ==/UserScript==
function css(input) {
return input.replace(/\s+/g, ' ')
}
const COPILOT_HIDDEN_REVIEW_CSS = css(`
display: flex;
align-items: center;
gap: 7px;
padding: 10px;
`)
const COPILOT_HIDDEN_REVIEW_TEXT_CSS = css(`
opacity: 0.85
`)
const SHOW_ANYWAY_BUTTON_CSS = css(`
border-radius: 5px;
border: none;
padding: 5px;
`)
const SHOW_COPILOT_REVIEWS_QUERY = 'show_copilot_reviews=true'
const COPILOT_REVIEW_HIDDEN_DIV = `
<div style="${COPILOT_HIDDEN_REVIEW_CSS}">
<span>🤖🚫 <i style="${COPILOT_HIDDEN_REVIEW_TEXT_CSS}">"Review" from GitHub Copilot hidden.</i></span>
<button style="${SHOW_ANYWAY_BUTTON_CSS}" onclick="window.location.assign(\`\${window.location.href}?${SHOW_COPILOT_REVIEWS_QUERY}\`)">Show anyway</button>
</div>
`
function timelineItemIsFromCopilot(itemDiv) {
return itemDiv.innerText.includes('Copilot AI reviewed')
}
function findCopilotReviews() {
const timelineItems = Array.from(document.querySelectorAll('.js-timeline-item'))
return timelineItems.filter(timelineItemIsFromCopilot)
}
function hideCopilotReviews() {
if (window.location.search.includes(SHOW_COPILOT_REVIEWS_QUERY)) {
return
}
const copilotReviews = findCopilotReviews()
for (const review of copilotReviews) {
review.innerHTML = COPILOT_REVIEW_HIDDEN_DIV
}
}
window.addEventListener('load', hideCopilotReviews)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment