-
Notifications
You must be signed in to change notification settings - Fork 0
/
set-github-labels.sh
executable file
·83 lines (66 loc) · 4.75 KB
/
set-github-labels.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
echo ''
echo 'This script will remove the GitHub default labels and create the 80|20 process labels for your repo. A personal access token is required to access private repos.'
echo ''
echo -n 'GitHub Personal Access Token: '
read -s TOKEN
echo ''
echo -n 'GitHub Org/Repo (e.g. foo/bar): '
read REPO
REPO_USER=$(echo "$REPO" | cut -f1 -d /)
REPO_NAME=$(echo "$REPO" | cut -f2 -d /)
# -----------------------------
# --- Delete default labels ---
# -----------------------------
echo ''
echo 'Deleting default labels...'
curl -u $TOKEN:x-oauth-basic --request DELETE https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/bug
curl -u $TOKEN:x-oauth-basic --request DELETE https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/duplicate
curl -u $TOKEN:x-oauth-basic --request DELETE https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/enhancement
curl -u $TOKEN:x-oauth-basic --request DELETE https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/help%20wanted
curl -u $TOKEN:x-oauth-basic --request DELETE https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/good%20first%20issue
curl -u $TOKEN:x-oauth-basic --request DELETE https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/invalid
curl -u $TOKEN:x-oauth-basic --request DELETE https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/question
curl -u $TOKEN:x-oauth-basic --request DELETE https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/wontfix
echo ''
echo 'Default labels deleted!'
# -----------------------------
# --- Create cancel labels ----
# -----------------------------
echo ''
echo 'Creating "cancel" labels...'
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"c- will not be realized","color":"ffffff"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"c- clone","color":"cccccc"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"c- invalide","color":"e6e6e6"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
# -----------------------------
# - Create depends on labels --
# -----------------------------
echo ''
echo 'Creating "depends on" labels...'
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"d- need Crystale","color":"C05192"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"d- need Parmi","color":"A93177"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"d- need testing","color":"8B195C"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
# -----------------------------
# -- Create internal labels ---
# -----------------------------
echo ''
echo 'Creating "internal" labels...'
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"i- enhancement","color":"146a87"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"i- help needed","color":"4d90a6"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"i- question","color":"033f53"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
# -----------------------------
# -- Create external labels ---
# -----------------------------
echo ''
echo 'Creating "external" labels...'
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"x- bug in prod","color":"d2111f"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"x- bug","color":"e93a47"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"x- urgent","color":"83000a"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
# -----------------------------
# ----- Create WIP labels -----
# -----------------------------
echo ''
echo 'Creating "project management" labels...'
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"0- in current milestone","color":"c2e0c6"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"1- in developement","color":"97CA9D"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"2- in test","color":"69AD71"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u $TOKEN:x-oauth-basic --include --request POST --data '{"name":"3- validated","color":"3E8E48"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"