Skip to content

Commit 04431bf

Browse files
authored
Only leave a comment when no more pending CI (GH-28)
- Ensure travis job has kicked off before checking for `pending` status.
1 parent 4607444 commit 04431bf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

backport/status_change.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ async def check_status(event, gh, *args, **kwargs):
2626
response = requests.get(status_url,
2727
headers=request_headers)
2828
result = response.json()
29-
print(f"miss-islington's PR state changed: {result['state']}")
30-
if result["state"] != "pending":
29+
all_ci_status = [status["state"] for status in result["statuses"]]
30+
all_ci_context = [status["context"] for status in result["statuses"]]
31+
print(f"miss-islington's PR state changed: {all_ci_status}")
32+
print(f"miss-islington's PR CI: {all_ci_context}")
33+
if "pending" not in all_ci_status \
34+
and "continuous-integration/travis-ci/pr" in all_ci_context:
3135
url = "https://api.github.com/repos/miss-islington/cpython/git/refs/heads/"
3236
response = requests.get(url, headers=request_headers)
3337
for ref in response.json():

0 commit comments

Comments
 (0)