Skip to content

Instantly share code, notes, and snippets.

@davidglezz
Last active October 3, 2021 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidglezz/ec070989b02674bbf6cf22e93c4f0fa1 to your computer and use it in GitHub Desktop.
Save davidglezz/ec070989b02674bbf6cf22e93c4f0fa1 to your computer and use it in GitHub Desktop.
Github: Unsubscribe from all "orgName" watched repositories
/**
* Unsubscribe from all "orgName" repositories in https://github.com/watching
*
* https://github.com/isaacs/github/issues/641
* @param string orgName
*/
function unwatchOrgRepos(orgName) {
if (!window.location.href.startsWith('https://github.com/watching')) {
throw new Error('This script is intended to be run in "https://github.com/watching"')
}
const repositories = document.querySelectorAll(".notifications-list .Box:first-child .repo-list > li");
repositories.forEach(item => {
const name = item.querySelector(".pr-3").innerText;
if (!name.startsWith(orgName)) return;
item.querySelector("notifications-list-subscription-form [value=included]")?.click(); // or value=ignore
});
window.location.reload();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment