-
-
Save offirgolan/9b12a2a170f70d0d70e2238e8661e382 to your computer and use it in GitHub Desktop.
// 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()}); |
there is an option to not automatically watch repositories when you get added to a team, but sometimes it's just a bit too late to learn about that option… :P
I actually want autowatch. I want to watch all the things. But now if someone adds me to the wrong team. Then I want to mass unwatch.
😭
Here's the latest working script, adapted from @gaqzi's
(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()));
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);
})();
@edman's revision worked today - thank you!
just a note that one needs to continue to reload the page and re-run the script multiple times if there are multiple screens.
there is an option to not automatically watch repositories when you get added to a team, but sometimes it's just a bit too late to learn about that option… :P
https://github.com/settings/notifications
That's a great tip - thank you, @gaqzi!
Thanks for the last revision @edman still working! This gist is amazing.
thank you guys, don't know what I would have done without you!
Thanks for the last revision @edman still working! This gist is amazing.
For me too -- thanks much!
My quick implementation to only remove stuff I don't want to track.
setInterval(() => {
let ignore = ['vite', 'vue', 'awesome', 'livewire'];
document.querySelectorAll('.Box-row').forEach((row) => {
let url = new URL(row.querySelector('a').href);
if (new RegExp(ignore.join("|")).test(url.pathname.toLowerCase())) return;
row.querySelector('button[value=included]').click();
});
}, 250);
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);
})();
This feature now seems to be integrated into https://github.com/watching. Just click "Unwatch all" and selected the organization.
hey @github PMs! notice me senpai. we struggle with autowatch, especially when added to teams with 1892731892379812739 repos.