@@ -38,12 +38,23 @@ if [ "$PR_NUMBER" -eq 0 ]; then
3838 exit 0
3939fi
4040
41+ if [ -z ${TOKEN:- ' ' } ]; then
42+ echo " ############################################################"
43+ echo " ############################################################"
44+ echo " WARNING: you should set the TOKEN variable to a github token"
45+ echo " ############################################################"
46+ echo " ############################################################"
47+ $GHCURL =" curl"
48+ else
49+ $GHCURL =" curl -H \" Authorization: token $TOKEN \" "
50+ fi
51+
4152CURRENT_BRANCH=` git rev-parse --abbrev-ref HEAD`
42- PULL_JSON=` curl -s https://api.github.com/repos/angular/angular/pulls/$PR_NUMBER `
53+ PULL_JSON=` $GHCURL -s https://api.github.com/repos/angular/angular/pulls/$PR_NUMBER `
4354PR_SHA_COUNT=` node $BASEDIR /utils/json_extract.js commits <<< " " " $PULL_JSON " " " `
4455STATUS_JSON_URL=` node $BASEDIR /utils/json_extract.js _links.statuses.href <<< " " " $PULL_JSON " " " `
45- STATUS=` curl -s $STATUS_JSON_URL | node $BASEDIR /utils/json_extract.js description | cut -d ' |' -f1`
46- PR_LABELS=` curl -s https://api.github.com/repos/angular/angular/issues/$PR_NUMBER /labels`
56+ STATUS=` $GHCURL -s $STATUS_JSON_URL | node $BASEDIR /utils/json_extract.js description | cut -d ' |' -f1`
57+ PR_LABELS=` $GHCURL -s https://api.github.com/repos/angular/angular/issues/$PR_NUMBER /labels`
4758PR_ACTION=` echo " $PR_LABELS " | node $BASEDIR /utils/json_extract.js " name=^PR action:" `
4859PR_TARGET=` echo " $PR_LABELS " | node $BASEDIR /utils/json_extract.js " name=^PR target:" `
4960PR_CLA=` echo " $PR_LABELS " | node $BASEDIR /utils/json_extract.js " name=^cla" `
@@ -64,7 +75,7 @@ if [[ "$STATUS" != "All checks passed!" ]]; then
6475 echo PR $PR_NUMBER is failing with: $STATUS
6576 if [[ $FORCE == 1 ]]; then
6677 echo FORCING: --force flag used to ignor PR status.
67- else
78+ else
6879 echo Exting...
6980 exit 1
7081 fi
0 commit comments