summaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2022-01-25 13:23:29 -0500
committerNed Batchelder <ned@nedbatchelder.com>2022-01-25 13:23:29 -0500
commited85bfb11be2456c8dc006f203ae3f656c7b885d (patch)
treebb2e680554f2498acc8b9f2fc7607b0241da26ff /ci
parent968c6c02f78d17abf3b8c37d3e569516dbbe6525 (diff)
downloadpython-coveragepy-git-ed85bfb11be2456c8dc006f203ae3f656c7b885d.tar.gz
build: latest tweaks to howto, and start of more automation
Diffstat (limited to 'ci')
-rw-r--r--ci/comment_on_fixes.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/ci/comment_on_fixes.py b/ci/comment_on_fixes.py
new file mode 100644
index 00000000..b76a6cda
--- /dev/null
+++ b/ci/comment_on_fixes.py
@@ -0,0 +1,32 @@
+"""Add a release comment to all the issues mentioned in the latest release."""
+
+import json
+import re
+import time
+
+import requests
+
+with open("tmp/relnotes.json") as frn:
+ relnotes = json.load(frn)
+
+latest = relnotes[0]
+version = latest["version"]
+comment = (
+ f"This is now released as part of [coverage {version}]" +
+ f"(https://pypi.org/project/coverage/{version})."
+ )
+print(f"Comment will be: {comment}")
+
+owner = "nedbat"
+repo = "coveragepy"
+for m in re.finditer(r"https://github.com/nedbat/coveragepy/(issues|pull)/(\d+)", latest["text"]):
+ 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)
+ else:
+ print(f"You need to manually coment on {m[0]}")