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>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user