Skip to content

Instantly share code, notes, and snippets.

@dsample
Created November 16, 2016 12:08
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 dsample/833b74c9f389c00bfa2e94c772d71894 to your computer and use it in GitHub Desktop.
Save dsample/833b74c9f389c00bfa2e94c772d71894 to your computer and use it in GitHub Desktop.
A JavaScript snippet to help 'leave' many repositories where you have been added as a contributor

I got added as a contributor in ~400 repositories in my organisation by accident. This JavaScript helped me undo that problem. Just head over to https://github.com/settings/repositories, change the logic for which repositories you want to leave and then run the leaveOne as many times as necessary.

function leaveOne() {
const repos = document.getElementsByClassName('listgroup-item')
const repo = [].slice.call(repos).filter((item) => item.innerText.split('/')[0] == 'Leave xxx')[0]
console.log('repo', repo)
let name = repo.getElementsByClassName('mr-1')[1].innerText.split('/')
console.log("Leaving", name[1])
repo.getElementsByClassName('float-right')[0].click()
setTimeout(() => {
// document.getElementsByClassName('facebox-close')[0].click()
document.getElementById('facebox').getElementsByClassName('btn')[0].click()
}, 250)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment