Skip to content

Instantly share code, notes, and snippets.

@marcaube
Forked from tonybaloney/tidy.sh
Last active November 11, 2024 18:29
Show Gist options
  • Save marcaube/7c6597cad9dd12df1f88b96b96bba71d to your computer and use it in GitHub Desktop.
Save marcaube/7c6597cad9dd12df1f88b96b96bba71d 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 marcaube \
--updated="<2020-01-01" \
--include-forks=only \
--limit 100 \
--json url \
--jq ".[] .url" | xargs -I {} gh repo delete {} --yes
# Archive repos that haven't been updated since 2019
gh search repos \
--owner marcaube \
--updated="<2019-01-01" \
--archived=false \
--limit 100 \
--json url \
--jq ".[] .url" | xargs -I {} gh repo archive {} --yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment