Skip to content

Instantly share code, notes, and snippets.

@offirgolan
Created August 2, 2017 05:57
Show Gist options
  • Save offirgolan/9b12a2a170f70d0d70e2238e8661e382 to your computer and use it in GitHub Desktop.
Save offirgolan/9b12a2a170f70d0d70e2238e8661e382 to your computer and use it in GitHub Desktop.
Unwatch All Org Repos
// Navigate to https://github.com/watching and then run:
// Taken from: https://stackoverflow.com/questions/11043374/how-to-unwatch-multiple-repos-easily-on-github
Array.prototype
.slice.apply(document.querySelectorAll('.js-subscription-row'))
.forEach(el => { const org = el.querySelector('a[href^="/YOUR_ORG"]'); if (org) el.querySelector('button').click()});
@Mehul
Copy link

Mehul commented Nov 10, 2021

Had to modify script from @edman / @gaqzi to get it work for me in FF/Chrome. Minor changes, thanks to @dwells:

(function() {
  let qx = $x;
  let unwatch = function(org, notificationType) {
    let nodes = document.querySelectorAll(".Box-row");
    let rows = [...nodes];
    let orgRows = rows.filter(e => e.innerText.startsWith(`${org}/`));
    let orgUnsubButtons = orgRows.map(row =>
      row.querySelector(`button.SelectMenu-item[value="${notificationType}"]`)
    );
    orgUnsubButtons.forEach(button => console.log(button.click()));
    //orgUnsubButtons.forEach(button => console.log(`click ${notificationType}`));
    setTimeout(function() {}, 1000);
  };
  let org = "ORG"; // <--- change ORG to desired organization, and repeat for all pages
  let notificationType = "included"; // 'included' = participating and @mentions, 'subscribed' = all activity, 'ignore' = ignore
  unwatch(org, notificationType);
})();

@Anigif
Copy link

Anigif commented Mar 21, 2022

This feature now seems to be integrated into https://github.com/watching. Just click "Unwatch all" and selected the organization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment