Skip to content

Instantly share code, notes, and snippets.

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 chenrui333/819e5c8b7bf0e2bce2b9fb263adfe16c to your computer and use it in GitHub Desktop.
Save chenrui333/819e5c8b7bf0e2bce2b9fb263adfe16c to your computer and use it in GitHub Desktop.
Delete stale branches from the GitHub repo's stale branches page (github.com/user/repo/branches/stale). Originally from https://stackoverflow.com/a/69089905
// Paste in browser console and run
async function deleteStaleBranches(delay=30) {
var stale_branches = document.getElementsByClassName('types__StyledButton-sc-ws60qy-0 fakZEC');
for (var i = 0; i < stale_branches.length; i++)
{
stale_branches.item(i).click();
await new Promise(r => setTimeout(r, delay));
}
}
(() => { deleteStaleBranches(30); })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment