Use auth when connecting to Github API
Paweł Krupa committed
Dec 18, 2018 at 02:32 UTC
dce316c8b4aeaca766e2d862c957ee7029dd0b3e
1 file changed
+3
-3
.travis/labeler.sh
+3
-3
@@ -16,7 +16,7 @@ new_labels() {
16
# remove duplicate quotes in case parameters were already quoted
17
LABELS="${LABELS//\"\"/\"}"
18
echo "-------- Assigning labels to #${ISSUE}: ${LABELS} --------"
19
- curl -H "Authorization: token $GITHUB_TOKEN" -d "{\"labels\":[${LABELS}]}" -X PUT "${URL}" &>/dev/null
19
+ curl -H "Authorization: token $GITHUB_TOKEN" -d "{\"labels\":[${LABELS}]}" -X POST "${URL}" &>/dev/null
20
}
21
22
if [ "$GITHUB_TOKEN" == "" ]; then
@@ -41,7 +41,7 @@ echo "===== Categorizing issues ====="
41
for STATE in "open" "closed"; do
42
for ISSUE in $(hub issue -f "%I %l%n" -s "$STATE" -d "$(date +%F -d '1 day ago')" | grep -v -f $LABELS_FILE); do
43
echo "-------- Processing $STATE issue no. $ISSUE --------"
44
- BODY="$(curl "https://api.github.com/repos/netdata/netdata/issues/$ISSUE" 2>/dev/null | jq .body)"
44
+ BODY="$(curl -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/netdata/netdata/issues/$ISSUE" 2>/dev/null | jq .body)"
45
case "${BODY}" in
46
*"# Question summary"*) new_labels "$ISSUE" "question" "no changelog" ;;
47
*"# Bug report summary"*) new_labels "$ISSUE" "needs triage" "bug" ;;
@@ -91,7 +91,7 @@ for PR in $(hub pr list -s all -f "%I%n" -L 10); do
91
done
92
NEW_SET=$(sort $NEW_LABELS | uniq)
93
if [ ! -z "$NEW_SET" ]; then
94
- PREV=$(curl "https://api.github.com/repos/netdata/netdata/issues/$PR/labels" 2>/dev/null | jq '.[].name' | grep -v "area")
94
+ PREV=$(curl -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/netdata/netdata/issues/$PR/labels" 2>/dev/null | jq '.[].name' | grep -v "area")
95
new_labels "$PR" ${NEW_SET} "${PREV[*]}"
96
fi
97
done