Last active
October 3, 2021 16:32
-
-
Save davidglezz/ec070989b02674bbf6cf22e93c4f0fa1 to your computer and use it in GitHub Desktop.
Github: Unsubscribe from all "orgName" watched repositories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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