Created
October 12, 2021 14:59
-
-
Save KyMidd/58fc9d3aec246d0768c3bf9da79a1241 to your computer and use it in GitHub Desktop.
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
# Attempt git push, check for archived to safely catch | |
gitPushResults= | |
gitPushResults=$(git push --force --set-upstream origin main 2>&1 || true) | |
# Check if failed to push due to archived read-only | |
if echo "$gitPushResults" | grep -q "This repository was archived"; then | |
echo "This repository is archived, and is read-only, skipping" | |
# Cleanup | |
cd ../ | |
rm -rf $repo | |
# Continue to next loop | |
continue | |
elif echo "$gitPushResults" | grep -q "already exists"; then | |
echo "Pull request already exists with this name, skipping" | |
# Cleanup | |
cd ../ | |
rm -rf $repo | |
# Continue to next loop | |
continue | |
fi | |
else | |
# Repo cloned successfully | |
cd $repo | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment