Skip to content

Instantly share code, notes, and snippets.

@andrewpetrochenkov
Last active May 25, 2020 06:15
Show Gist options
  • Save andrewpetrochenkov/cc6408967d66a0c114b42ea2f3f73aae to your computer and use it in GitHub Desktop.
Save andrewpetrochenkov/cc6408967d66a0c114b42ea2f3f73aae to your computer and use it in GitHub Desktop.
github delete orphaned repos
#!/usr/bin/env bash
# pip install github-delete github-repos
# export GITHUB_TOKEN=<GITHUB_TOKEN>
repos="$(python -m github_repos)" || exit
[[ -n "$repos" ]] && while IFS= read full_name; do
path=~/git/"$full_name"
! [ -e "$path" ] && { ( set -x; github-delete "$full_name" ) || exit; }
done <<< "$repos";:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment