Change companion check order (#8460)

* Change companion check order

Apparently if the pr isn't approved it counts as not mergable. However,
this is rahter confusing. To fix this, we just change the order.

* Move exit
This commit is contained in:
Bastian Köcher
2021-03-26 14:21:00 +01:00
committed by GitHub
parent da4518e518
commit 6adf24ca0c
@@ -56,27 +56,7 @@ fi
boldprint "companion pr: #${pr_companion}" boldprint "companion pr: #${pr_companion}"
# check the status of that pull request - needs to be # check the status of that pull request - needs to be
# mergable and approved # approved and mergable
curl -H "${github_header}" -sS -o companion_pr.json \
${github_api_polkadot_pull_url}/${pr_companion}
pr_head_sha=$(jq -r -e '.head.sha' < companion_pr.json)
boldprint "Polkadot PR's HEAD SHA: $pr_head_sha"
if jq -e .merged < companion_pr.json >/dev/null
then
boldprint "polkadot pr #${pr_companion} already merged"
exit 0
fi
if jq -e '.mergeable' < companion_pr.json >/dev/null
then
boldprint "polkadot pr #${pr_companion} mergeable"
else
boldprint "polkadot pr #${pr_companion} not mergeable"
exit 1
fi
curl -H "${github_header}" -sS -o companion_pr_reviews.json \ curl -H "${github_header}" -sS -o companion_pr_reviews.json \
${github_api_polkadot_pull_url}/${pr_companion}/reviews ${github_api_polkadot_pull_url}/${pr_companion}/reviews
@@ -98,6 +78,25 @@ if [ -z "$(jq -r -e '.[].state | select(. == "APPROVED")' < companion_pr_reviews
fi fi
boldprint "polkadot pr #${pr_companion} state APPROVED" boldprint "polkadot pr #${pr_companion} state APPROVED"
curl -H "${github_header}" -sS -o companion_pr.json \
${github_api_polkadot_pull_url}/${pr_companion}
pr_head_sha=$(jq -r -e '.head.sha' < companion_pr.json)
boldprint "Polkadot PR's HEAD SHA: $pr_head_sha"
if jq -e .merged < companion_pr.json >/dev/null
then
boldprint "polkadot pr #${pr_companion} already merged"
exit 0
fi
if jq -e '.mergeable' < companion_pr.json >/dev/null
then
boldprint "polkadot pr #${pr_companion} mergeable"
else
boldprint "polkadot pr #${pr_companion} not mergeable"
exit 1
fi
exit 0 exit 0