Skip to content

Commit 4a0bc8d

Browse files
committed
support file label
ref Coderockr#7
1 parent 8ce524b commit 4a0bc8d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

coderockr-way-github-setup.bash

+10-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ function getHelp {
66
--help, -h Show this help
77
--user, -u GitHub username
88
--password, -p GitHub password
9+
--file, -f Set label file
910
--verbose, -v Details process
1011
1112
Usage:
@@ -38,9 +39,12 @@ do
3839
elif [[ $i == '--user' ]] || [[ $i == '-u' ]]; then
3940
GITHUB_USERNAME=${args[$counter + 1]}
4041
readed_counter=$[$readed_counter + 1]
41-
elif [[ $i == '--password' ]] || [[ $i == '-p' ]]; then
42+
elif [[ $i == '--password' ]] || [[ $i == '-p' ]]; then
4243
GITHUB_PASSWORD=${args[$counter + 1]}
4344
readed_counter=$[$readed_counter + 1]
45+
elif [[ $i == '--file' ]] || [[ $i == '-f' ]]; then
46+
LABEL_FILE=${args[$counter + 1]}
47+
readed_counter=$[$readed_counter + 1]
4448
elif [[ $i == '--verbose' ]] || [[ $i == '-v' ]]; then
4549
VERBOSE=1
4650
else
@@ -79,7 +83,10 @@ invalid
7983
question
8084
wontfix'
8185

82-
LABELS='Category: Backend,c2e0c6
86+
if [ -f $LABEL_FILE ]; then
87+
LABELS="$(cat ${LABEL_FILE})"
88+
else
89+
LABELS='Category: Backend,c2e0c6
8390
Category: Business/Meetings,0e8a16
8491
Category: DevOps,fef2c0
8592
Category: Frontend,bfdadc
@@ -108,6 +115,7 @@ Type: Bug,fc2929
108115
Type: Improvement,84b6eb
109116
Type: New feature,0052cc
110117
Type: Sub-task,ededed'
118+
fi
111119

112120
if [[ "$VERBOSE" == 1 ]]; then
113121
echo "Removing default labels"
@@ -141,4 +149,3 @@ while read -r label; do
141149
echo "Label \"$label_name\" created"
142150
fi
143151
done <<< "$LABELS"
144-

0 commit comments

Comments
 (0)