Skip to content

Instantly share code, notes, and snippets.

@tonybaloney
Last active April 22, 2023 20:17
Show Gist options
  • Save tonybaloney/867ed83067c047a0c6e4d660cc5968fc to your computer and use it in GitHub Desktop.
Save tonybaloney/867ed83067c047a0c6e4d660cc5968fc to your computer and use it in GitHub Desktop.
tidy script
# Delete all forks that haven't been updated since 2020
gh auth refresh -h github.com -s delete_repo
gh search repos \
--owner tonybaloney \
--updated="<2020-01-01" \
--include-forks=only \
--limit 100 \
--json url \
--jq ".[] .url" \ | xargs -I {} gh repo delete {} --confirm
# Archive repos that haven't been updated since 2019
gh search repos \
--owner tonybaloney \
--updated="<2019-01-01" \
--limit 100 \
--json url \
--jq ".[] .url" | xargs -I {} gh repo archive {} --confirm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment