Skip to content

Instantly share code, notes, and snippets.

@tony19
Created February 19, 2022 18:04
Show Gist options
  • Save tony19/02318b7bbdfc523249f724f9d20e1a7e to your computer and use it in GitHub Desktop.
Save tony19/02318b7bbdfc523249f724f9d20e1a7e to your computer and use it in GitHub Desktop.
Script to make GitHub repo private and archived
#!/bin/sh -e
if [ $# -eq 0 ]; then
echo "usage: $0 <repo> [<repo> ...]"
exit 1
fi
repos=$@
makePrivateAndArchiveRepo () {
repo="$1"
echo "making $r private archived"
gh api -X PATCH /repos/$repo \
-fvisibility=private \
-farchived=true \
--preview nebula \
--silent
}
for r in $repos
do
echo $r
read -p 'Stash this repo? ' yn
if [ "$yn" == "y" ]
then
makePrivateAndArchiveRepo $r
fi
done
echo 'done'
@tony19
Copy link
Author

tony19 commented Feb 19, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment