Skip to content

Commit

Permalink
Merge pull request CatalystCode#6 from samiyaakhtar/1330
Browse files Browse the repository at this point in the history
Bug fix for smoke test failures when PR is not found
  • Loading branch information
samiyaakhtar committed Apr 14, 2020
2 parents 3a95e23 + 1bf5e67 commit 80e285d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,13 @@ function approve_pull_request () {

pr_exists=$(echo $all_prs | sed 's/\\r\\n//g' | jq -r --arg pr_title "$pr_title" '.[].title | select(startswith($pr_title)) != null')
if [ "$pr_exists" != "true" ]; then
echo "PR for '$pr_title' not found"
exit 1
if [ $pr_exists != *"true"* ]; then
echo "PR for '$pr_title' not found"
exit 1
fi
fi
real_title=$(echo $all_prs | jq -r --arg pr_title "$pr_title" 'select(.[].title | startswith($pr_title)) | .[].title' | head -n 1)
pull_request_id=$(echo $all_prs | jq -r --arg pr_title "$pr_title" 'select(.[].title | startswith($pr_title)) | .[0].pullRequestId')
pull_request_id=$(echo $all_prs | jq -r --arg pr_title "$pr_title" 'select(.[0].title | startswith($pr_title)) | .[0].pullRequestId')
echo "Found pull request starting with phrase '$pr_title'"
echo "Pull request id $pull_request_id is '$real_title'"

Expand Down

0 comments on commit 80e285d

Please sign in to comment.