From a2cc599a2a026e4cc07eb61653ff8a42af4e490e Mon Sep 17 00:00:00 2001 From: Nadav Har'El Date: Wed, 23 Sep 2020 18:19:05 +0300 Subject: [PATCH] scripts/pull_github_pr.sh: some nicer messages The script scripts/pull_github_pr.sh begins by fetching some information from github, which can cause a noticable wait that the user doesn't understand - so in this patch we add a couple of messages on what is happening in the beginning of the script. Moreover, if an invalid pull-request number is given, the script used to give mysterious errors when incorrect commands ran using the name "null" - in this patch we recognize this case and print a clear "Not Found" error message. Finally, the PR_REPO variable was never used, so this patch removes it. Message-Id: <20200923151905.674565-1-nyh@scylladb.com> --- scripts/pull_github_pr.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/pull_github_pr.sh b/scripts/pull_github_pr.sh index 14288be882..fcb50e412f 100755 --- a/scripts/pull_github_pr.sh +++ b/scripts/pull_github_pr.sh @@ -26,13 +26,22 @@ NL=$'\n' PR_NUM=$1 PR_PREFIX=https://api.github.com/repos/scylladb/scylla/pulls +echo "Fetching info on PR #$PR_NUM... " PR_DATA=$(curl -s $PR_PREFIX/$PR_NUM) +MESSAGE=$(jq -r .message <<< $PR_DATA) +if [ "$MESSAGE" != null ] +then + # Error message, probably "Not Found". + echo "$MESSAGE" + exit 1 +fi PR_TITLE=$(jq -r .title <<< $PR_DATA) +echo " $PR_TITLE" PR_DESCR=$(jq -r .body <<< $PR_DATA) PR_LOGIN=$(jq -r .head.user.login <<< $PR_DATA) -PR_REPO=$(jq -r .head.repo.html_url <<< $PR_DATA) - +echo -n "Fetching full name of author $PR_LOGIN... " USER_NAME=$(curl -s "https://api.github.com/users/$PR_LOGIN" | jq -r .name) +echo "$USER_NAME" git fetch origin pull/$PR_NUM/head