Skip to content

Commit f94f964

Browse files
committed
ci: correctly encode quoted params passed as params to curl
Previously the auth token could have been split into three separate args in bash which resulted in two bogus requests being sent out for each curl call. These requests had to time out before the real request was made, but without the token. I couldn't find a better way to quickly fix this without adding some duplication.
1 parent 4d5167e commit f94f964

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

scripts/github/merge-pr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ if [ -z ${TOKEN:-''} ]; then
4444
echo "WARNING: you should set the TOKEN variable to a github token"
4545
echo "############################################################"
4646
echo "############################################################"
47-
GHCURL="curl"
47+
GH_AUTH=""
4848
else
49-
GHCURL="curl -H \"Authorization: token $TOKEN\""
49+
GH_AUTH="Authorization: token $TOKEN"
5050
fi
5151

52-
PULL_JSON=`$GHCURL -s https://api.github.com/repos/angular/angular/pulls/$PR_NUMBER`
52+
PULL_JSON=`curl -H "$GH_AUTH" -s https://api.github.com/repos/angular/angular/pulls/$PR_NUMBER`
5353
PR_SHA_COUNT=`node $BASEDIR/utils/json_extract.js commits <<< """$PULL_JSON"""`
5454
STATUS_JSON_URL=`node $BASEDIR/utils/json_extract.js _links.statuses.href <<< """$PULL_JSON"""`
55-
STATUS=`$GHCURL -s $STATUS_JSON_URL | node $BASEDIR/utils/json_extract.js description | cut -d '|' -f1`
56-
PR_LABELS=`$GHCURL -s https://api.github.com/repos/angular/angular/issues/$PR_NUMBER/labels`
55+
STATUS=`curl -H "$GH_AUTH" -s $STATUS_JSON_URL | node $BASEDIR/utils/json_extract.js description | cut -d '|' -f1`
56+
PR_LABELS=`curl -H "$GH_AUTH" -s https://api.github.com/repos/angular/angular/issues/$PR_NUMBER/labels`
5757
PR_ACTION=`echo "$PR_LABELS" | node $BASEDIR/utils/json_extract.js "name=^PR action:"`
5858
PR_TARGET=`echo "$PR_LABELS" | node $BASEDIR/utils/json_extract.js "name=^PR target:"`
5959
PR_CLA=`echo "$PR_LABELS" | node $BASEDIR/utils/json_extract.js "name=^cla"`

0 commit comments

Comments
 (0)