ivankelly closed pull request #1145: Require green CI before merge
URL: https://github.com/apache/bookkeeper/pull/1145
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/dev/bk-merge-pr.py b/dev/bk-merge-pr.py
index 8c3415e20..c5dffe713 100755
--- a/dev/bk-merge-pr.py
+++ b/dev/bk-merge-pr.py
@@ -476,6 +476,19 @@ def get_reviewers(pr_num):
         reviewers_emails.append('{0} <{1}>'.format(username.encode('utf8'), 
useremail))
     return ', '.join(reviewers_emails)
 
+def check_ci_status(pr):
+    status_url = get_json("%s/commits/%s/status" % (GITHUB_API_BASE, 
pr["head"]["sha"]))
+    state = status_url["state"]
+    if state != "success":
+        comments = get_json(pr["comments_url"])
+        ignore_ci_comments = [c for c in comments if c["body"].upper() == 
"IGNORE CI"]
+        if len(ignore_ci_comments) > 0:
+            print "\n\nWARNING: The PR has not passed CI (state is %s)" % 
(state) \
+                + ", but this has been overridden by %s. \n" % 
(ignore_ci_comments[0]["user"]["login"]) \
+                + "Proceed at your own peril!\n\n"
+        else:
+            fail("The PR has not passed CI (state is %s)" % (state))
+
 def ask_release_for_github_issues(branch, labels):
     print "=== Add release to github issues ==="
     while True:
@@ -643,9 +656,11 @@ def main():
     pr = get_json("%s/pulls/%s" % (GITHUB_API_BASE, pr_num))
     pr_events = get_json("%s/issues/%s/events" % (GITHUB_API_BASE, pr_num))
     pr_reviewers = get_reviewers(pr_num)
+    check_ci_status(pr)
+
     url = pr["url"]
 
-    # 3. repare the title for commit message
+    # 3. repair the title for commit message
     pr_title = pr["title"]
     commit_title = raw_input("Commit title [%s]: " % 
pr_title.encode("utf-8")).decode("utf-8")
     if commit_title == "":


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to