From 04431bf8fb2010eeda85d099b7d6846f8ebb5705 Mon Sep 17 00:00:00 2001 From: Mariatta Date: Sun, 17 Sep 2017 18:17:07 -0700 Subject: [PATCH] Only leave a comment when no more pending CI (GH-28) - Ensure travis job has kicked off before checking for `pending` status. --- backport/status_change.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backport/status_change.py b/backport/status_change.py index 79d9b70e5ecf7e..6bd90da6f5fbf9 100644 --- a/backport/status_change.py +++ b/backport/status_change.py @@ -26,8 +26,12 @@ async def check_status(event, gh, *args, **kwargs): response = requests.get(status_url, headers=request_headers) result = response.json() - print(f"miss-islington's PR state changed: {result['state']}") - if result["state"] != "pending": + all_ci_status = [status["state"] for status in result["statuses"]] + all_ci_context = [status["context"] for status in result["statuses"]] + print(f"miss-islington's PR state changed: {all_ci_status}") + print(f"miss-islington's PR CI: {all_ci_context}") + if "pending" not in all_ci_status \ + and "continuous-integration/travis-ci/pr" in all_ci_context: url = "https://api.github.com/repos/miss-islington/cpython/git/refs/heads/" response = requests.get(url, headers=request_headers) for ref in response.json():