Skip to content

Commit 3e5fbc0

Browse files
thomasjpfanglemaitre
authored andcommitted
CI Do not post again if CI no longer failing exists (#23768)
1 parent 24e1ba1 commit 3e5fbc0

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

maint_tools/update_tracking_issue.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,19 @@ def close_issue_if_opened():
101101
print("Test has no failures!")
102102
issue = get_issue()
103103
if issue is not None:
104-
comment = (
105-
f"## CI is no longer failing! ✅\n\n[Successful run]({args.link_to_ci_run})"
104+
# Comment only if the "## CI is no longer failing" comment does not exist
105+
comment_exists = any(
106+
c.body.startswith("## CI is no longer failing")
107+
for c in issue.get_comments()
106108
)
107-
print(f"Commented on issue #{issue.number}")
108-
issue.create_comment(body=comment)
109+
if not comment_exists:
110+
comment = (
111+
"## CI is no longer failing! ✅\n\n[Successful"
112+
f" run]({args.link_to_ci_run})"
113+
)
114+
print(f"Commented on issue #{issue.number}")
115+
issue.create_comment(body=comment)
116+
109117
if args.auto_close.lower() == "true":
110118
print(f"Closing issue #{issue.number}")
111119
issue.edit(state="closed")

0 commit comments

Comments
 (0)