Improve commenting logic to not produce repetitive comments #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Previously, the bot would generally make a new comment when it had something to say on a particular PR, except in the case where the new comment would be exactly the same as the previous one (in which case no comment is created).
This turns out to be not quite good enough: on a regular MR that's waiting for its window, even if the status generally remains as "merge scheduled", the precise content of the comment could change slightly (e.g. when the MR becomes briefly unmergeable because tests rerun or the branch was updated), resulting in a string of similar-looking comments.
I thus devised a better system for comments. Comments now have a "title", which is written in bold. If the bot adds a new comment and detects that there is already a previous comment with the same title, the previous comment is updated. If the title differs, a new comment is always created - this way, we don't lose the record when potential errors occur, but we also don't flood the PR with repetitions of similar status updates. The most recent comment will always have the most recent status update.
Checklist
bug
,enhancement
,documentation
,change
,breaking
,dependency
as they show up in the changelog