-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremove-repo
More file actions
executable file
·32 lines (25 loc) · 839 Bytes
/
remove-repo
File metadata and controls
executable file
·32 lines (25 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
#
# Remove Repo
# shellcheck disable=SC1091
source "$HOME/.trainingmanualrc"
#################################################################
# NOTE: You must have a personal access token (PAT) #
# saved to your environment variables to use this script. #
# We recommend a dedicated service account (e.g. githubteacher) #
#################################################################
# GLOBALS
REPO_NAME=$1
function DeleteIt() {
echo "Deleting $CLASS_ORG/$REPO_NAME"
curl -s -S -i -H "Authorization: token $TEACHER_PAT" -X DELETE "https://$INSTANCE_URL/repos/$CLASS_ORG/$REPO_NAME" >>log.out 2>&1
# Load the error code
ERROR_CODE=$?
# Check the shell for errors
if [ $ERROR_CODE -ne 0 ]; then
echo "ERROR! Failed to Delete it!"
exit 1
fi
}
# Delete the repo
DeleteIt