This commit is contained in:
Lorin Werthen 2018-10-16 21:41:47 +02:00
parent e58b818223
commit 605930927e
No known key found for this signature in database
GPG key ID: F11FFC921E0E08E0

View file

@ -4,7 +4,8 @@ PR_NR=$TRAVIS_PULL_REQUEST
function performQuery() { function performQuery() {
NEW_QUERY_STR="{\"query\":\"$1\"}" NEW_QUERY_STR="{\"query\":\"$1\"}"
curl -s -H "Authorization: bearer $COMMENT_TOKEN" -X POST -d $NEW_QUERY_STR https://api.github.com/graphql echo $NEW_QUERY_STR
curl -s -H "Authorization: bearer $COMMENT_TOKEN" -X POST -d "$NEW_QUERY_STR" https://api.github.com/graphql
} }
RESULT=$(performQuery "{repository(owner:\\\"ZeusWPI\\\",name:\\\"zeus.ugent.be\\\"){pullRequest(number:$PR_NR){id,comments(first:10){nodes{author{login}}}}}}") RESULT=$(performQuery "{repository(owner:\\\"ZeusWPI\\\",name:\\\"zeus.ugent.be\\\"){pullRequest(number:$PR_NR){id,comments(first:10){nodes{author{login}}}}}}")
@ -22,7 +23,7 @@ if [[ $RESULT == *"werthen"* ]]; then
echo "User has already commented" echo "User has already commented"
else else
ADD_COMMENT_STR="mutation{addComment(input:{subjectId:\\\"$PR_ID\\\",body:\\\"Check out the preview on https://$PR_NR.pr.zeus.gent/\\\"}){clientMutationId}}" ADD_COMMENT_STR="mutation{addComment(input:{subjectId:\\\"$PR_ID\\\",body:\\\"Check out the preview on https://$PR_NR.pr.zeus.gent/\\\"}){clientMutationId}}"
performQuery $ADD_COMMENT_STR performQuery "$ADD_COMMENT_STR"
fi fi