Skip to content

Instantly share code, notes, and snippets.

@jacobkahn
Created January 31, 2019 16:23
Show Gist options
  • Save jacobkahn/3d84b19a89db513857571404f1292cc3 to your computer and use it in GitHub Desktop.
Save jacobkahn/3d84b19a89db513857571404f1292cc3 to your computer and use it in GitHub Desktop.
Unsubscribe from Repositories in an Org
function unwatchOrgRepos(orgName, repoNameFirstFourChars) {
var repoItems = document.querySelectorAll(".repo-list > li")
repoItems.forEach(function (item) {
var repoOrgElement = item.querySelector(".repo-name").previousElementSibling;
var repoElement = item.querySelector(".repo-name");
var repoOrgName = repoOrgElement.innerText;
if (repoOrgName === orgName && repoElement.innerHTML.substring(0, 4) == repoNameFirstFourChars) {
var unwatchButton = item.querySelector(".js-unsubscribe-form > button");
unwatchButton.click();
var itemName = repoOrgElement.parentElement.innerText;
console.log("Unwatched " + itemName);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment