Created
September 20, 2023 07:22
-
-
Save vincenthz/3fcc8218f20aad42542c31f7dae39593 to your computer and use it in GitHub Desktop.
close all issues, PRs and archive a repository on github
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 | |
# | |
# Close all issues, PR, and archive a repository | |
if [ $# -ne 1 ]; then | |
echo "usage: $0 <github-repository>" | |
exit 1 | |
fi | |
REPO=$1 | |
echo "# archiving repository $REPO" | |
echo "-> closing issues ..." | |
for issue in $(gh issue list --state open -R ${REPO} --json number --jq '.[].number') | |
do | |
gh issue close -R ${REPO} ${issue} -r "not planned" | |
done | |
echo "-> closing PRs ..." | |
for pr in $(gh pr list --state open -R ${REPO} --json number --jq '.[].number') | |
do | |
gh pr close -R ${REPO} -c "archiving repository" $pr | |
done | |
echo "-> archiving ..." | |
gh repo archive $REPO -y | |
echo "=> done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment