Created
February 19, 2022 18:04
-
-
Save tony19/02318b7bbdfc523249f724f9d20e1a7e to your computer and use it in GitHub Desktop.
Script to make GitHub repo private and archived
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uses
gh
(GitHub CLI)