Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Check status also checks that required statuses pass
Browse files Browse the repository at this point in the history
  • Loading branch information
cecton committed Jul 22, 2020
1 parent 54aeef3 commit a66a759
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
12 changes: 0 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -353,18 +353,6 @@ check-polkadot-companion-status:
script:
- ./.maintain/gitlab/check_polkadot_companion_status.sh

check-polkadot-companion-build:
stage: build
<<: *docker-env
needs:
- job: test-linux-stable-int
artifacts: false
script:
- ./.maintain/gitlab/check_polkadot_companion_build.sh
after_script:
- cd polkadot && git rev-parse --abbrev-ref HEAD
allow_failure: true

test-browser-node:
stage: build
<<: *docker-env
Expand Down
19 changes: 16 additions & 3 deletions .maintain/gitlab/check_polkadot_companion_status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,24 @@ then
exit 0
fi

if jq -e '.mergeable' < companion_pr.json >/dev/null
# WARNING: mergeable_state is an undocumented field of GitHub's API that exists since at least
# February 2018. The following values are possible at the moment (2020-07-22):
# - dirty: Merge conflict. Merging will be blocked
# - unknown: Mergeability was not checked yet. Merging will be blocked
# - blocked: Blocked by a failing/missing required status check.
# - behind: Head branch is behind the base branch. Only if required status checks is enabled but
# loose policy is not. Merging will be blocked.
# - unstable: Failing/pending commit status that is not part of the required status checks. Merging
# is allowed (yellow box). (unstable seems to take precedence on block, which is annoying)
# - has_hooks: GitHub Enterprise only, if a repo has custom pre-receive hooks. Merging is allowed
# (green box).
# - clean: No conflicts, everything good. Merging is allowed (green box).
mergeable_state=$(jq -r .mergeable_state < companion_pr.json)
if [ "$mergeable_state" == clean ]
then
boldprint "polkadot pr #${pr_companion} mergeable"
boldprint "polkadot pr #${pr_companion} mergeable ($mergeable_state)"
else
boldprint "polkadot pr #${pr_companion} not mergeable"
boldprint "polkadot pr #${pr_companion} not mergeable ($mergeable_state != clean)"
exit 1
fi

Expand Down

0 comments on commit a66a759

Please sign in to comment.