-
Notifications
You must be signed in to change notification settings - Fork 0
/
deleteRepo.sh
executable file
·21 lines (21 loc) · 1.01 KB
/
deleteRepo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
#-----------------------------------------------------------------
# Shell Script to delete a GitHub Repository
# Author : Eduardo Rocha - ehrocha@gmail.com
#-----------------------------------------------------------------
# https://docs.github.com/rest/reference/repos#delete-a-repository
#-----------------------------------------------------------------
# Variable Initialization
# Package jq is required for parsing the JSON file
#-----------------------------------------------------------------
urepo=$1;
uname=($(jq -r '.uname' ~/.github/config.json));
utoken=($(jq -r '.utoken' ~/.github/config.json));
#-----------------------------------------------------------------
# Requesting Repository Deletion from the API
#-----------------------------------------------------------------
echo " Deleting repository named ${urepo} for user ${uname}";
curl -X DELETE \
-H "Authorization: token ${utoken}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${uname}/${urepo}";