From f94f9640d0c9defb49731eb238674cf3821b8b21 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Mon, 30 Jul 2018 16:46:11 -0700 Subject: [PATCH] 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. --- scripts/github/merge-pr | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/github/merge-pr b/scripts/github/merge-pr index faa8aa4528..a3206c0691 100755 --- a/scripts/github/merge-pr +++ b/scripts/github/merge-pr @@ -44,16 +44,16 @@ if [ -z ${TOKEN:-''} ]; then echo "WARNING: you should set the TOKEN variable to a github token" echo "############################################################" echo "############################################################" - GHCURL="curl" + GH_AUTH="" else - GHCURL="curl -H \"Authorization: token $TOKEN\"" + GH_AUTH="Authorization: token $TOKEN" fi -PULL_JSON=`$GHCURL -s https://api.github.com/repos/angular/angular/pulls/$PR_NUMBER` +PULL_JSON=`curl -H "$GH_AUTH" -s https://api.github.com/repos/angular/angular/pulls/$PR_NUMBER` PR_SHA_COUNT=`node $BASEDIR/utils/json_extract.js commits <<< """$PULL_JSON"""` STATUS_JSON_URL=`node $BASEDIR/utils/json_extract.js _links.statuses.href <<< """$PULL_JSON"""` -STATUS=`$GHCURL -s $STATUS_JSON_URL | node $BASEDIR/utils/json_extract.js description | cut -d '|' -f1` -PR_LABELS=`$GHCURL -s https://api.github.com/repos/angular/angular/issues/$PR_NUMBER/labels` +STATUS=`curl -H "$GH_AUTH" -s $STATUS_JSON_URL | node $BASEDIR/utils/json_extract.js description | cut -d '|' -f1` +PR_LABELS=`curl -H "$GH_AUTH" -s https://api.github.com/repos/angular/angular/issues/$PR_NUMBER/labels` PR_ACTION=`echo "$PR_LABELS" | node $BASEDIR/utils/json_extract.js "name=^PR action:"` PR_TARGET=`echo "$PR_LABELS" | node $BASEDIR/utils/json_extract.js "name=^PR target:"` PR_CLA=`echo "$PR_LABELS" | node $BASEDIR/utils/json_extract.js "name=^cla"`