Skip to content

Commit

Permalink
Only leave a comment when no more pending CI (GH-28)
Browse files Browse the repository at this point in the history
- Ensure travis job has kicked off before checking for `pending` status.
  • Loading branch information
Mariatta authored Sep 18, 2017
1 parent 4607444 commit 04431bf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions backport/status_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 04431bf

Please sign in to comment.