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.

Revisions

  1. linuswillner revised this gist Apr 17, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hide-github-copilot-reviews.user.js
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ 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>
    <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>
    `
  2. linuswillner revised this gist Apr 17, 2025. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions hide-github-copilot-reviews.user.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // ==UserScript==
    // @name Hide GitHub Copilot reviews
    // @description Declutter GitHub pull requests by hiding reviews from Copilot
    // @version 1
    // @version 2
    // @namespace https://github.com/*/*/pull/*
    // @include https://github.com/*/*/pull/*
    // ==/UserScript==
    @@ -32,7 +32,7 @@ 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.replace(\`\${window.location.href}?${SHOW_COPILOT_REVIEWS_QUERY}\`)">Show anyway</button>
    <button style="${SHOW_ANYWAY_BUTTON_CSS}" onclick="window.location.assign(\`\${window.location.href}?${SHOW_COPILOT_REVIEWS_QUERY}\`)">Show anyway</button>
    </div>
    `

  3. linuswillner revised this gist Apr 17, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hide-github-copilot-reviews.user.js
    Original file line number Diff line number Diff line change
    @@ -32,7 +32,7 @@ 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 className="show-copilot-review" style="${SHOW_ANYWAY_BUTTON_CSS}" onclick="window.location.replace(\`\${window.location.href}?${SHOW_COPILOT_REVIEWS_QUERY}\`)">Show anyway</button>
    <button style="${SHOW_ANYWAY_BUTTON_CSS}" onclick="window.location.replace(\`\${window.location.href}?${SHOW_COPILOT_REVIEWS_QUERY}\`)">Show anyway</button>
    </div>
    `

  4. linuswillner revised this gist Apr 17, 2025. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions hide-github-copilot-reviews.user.js
    Original file line number Diff line number Diff line change
    @@ -11,18 +11,18 @@ function css(input) {
    }

    const COPILOT_HIDDEN_REVIEW_CSS = css(`
    display: flex;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px;
    `)

    const COPILOT_HIDDEN_REVIEW_TEXT_CSS = css(`
    opacity: 0.85
    opacity: 0.85
    `)

    const SHOW_ANYWAY_BUTTON_CSS = css(`
    border-radius: 5px;
    border-radius: 5px;
    border: none;
    padding: 5px;
    `)
    @@ -31,13 +31,13 @@ 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>
    <span>🤖🚫 <i style="${COPILOT_HIDDEN_REVIEW_TEXT_CSS}">Review from GitHub Copilot hidden.</i></span>
    <button className="show-copilot-review" style="${SHOW_ANYWAY_BUTTON_CSS}" onclick="window.location.replace(\`\${window.location.href}?${SHOW_COPILOT_REVIEWS_QUERY}\`)">Show anyway</button>
    </div>
    `

    function timelineItemIsFromCopilot(itemDiv) {
    return itemDiv.innerText.includes('Copilot AI reviewed')
    return itemDiv.innerText.includes('Copilot AI reviewed')
    }

    function findCopilotReviews() {
    @@ -50,10 +50,10 @@ function hideCopilotReviews() {
    return
    }

    const copilotReviews = findCopilotReviews()
    const copilotReviews = findCopilotReviews()

    for (const review of copilotReviews) {
    review.innerHTML = COPILOT_REVIEW_HIDDEN_DIV
    for (const review of copilotReviews) {
    review.innerHTML = COPILOT_REVIEW_HIDDEN_DIV
    }
    }

  5. linuswillner created this gist Apr 17, 2025.
    60 changes: 60 additions & 0 deletions hide-github-copilot-reviews.user.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    // ==UserScript==
    // @name Hide GitHub Copilot reviews
    // @description Declutter GitHub pull requests by hiding reviews from Copilot
    // @version 1
    // @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 className="show-copilot-review" style="${SHOW_ANYWAY_BUTTON_CSS}" onclick="window.location.replace(\`\${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)