From b1debdd7614d52b0476f4e4668f59011a06de15f Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 1 Feb 2022 20:51:26 -0500 Subject: build: version bump and more release details --- ci/comment_on_fixes.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'ci') diff --git a/ci/comment_on_fixes.py b/ci/comment_on_fixes.py index b76a6cda..f36cba93 100644 --- a/ci/comment_on_fixes.py +++ b/ci/comment_on_fixes.py @@ -2,7 +2,6 @@ import json import re -import time import requests @@ -23,10 +22,14 @@ for m in re.finditer(r"https://github.com/nedbat/coveragepy/(issues|pull)/(\d+)" kind, number = m.groups() if kind == "issues": - print(f"Commenting on {m[0]}") - url = f"https://api.github.com/repos/{owner}/{repo}/issues/{number}/comments" - resp = requests.post(url, json={"body": comment}) - print(resp) - time.sleep(1) + url = f"https://api.github.com/repos/{owner}/{repo}/issues/{number}" + issue_data = requests.get(url).json() + if issue_data["state"] == "closed": + print(f"Commenting on {m[0]}") + url = f"https://api.github.com/repos/{owner}/{repo}/issues/{number}/comments" + resp = requests.post(url, json={"body": comment}) + print(resp) + else: + print(f"Still open, comment manually: {m[0]}") else: print(f"You need to manually coment on {m[0]}") -- cgit v1.2.1