RFR: 1563: The method 'CheckRun#updateMergeReadyComment' shouldn't update the comment if the comment has not changed

Guoxiong Li gli at openjdk.org
Fri Sep 30 11:13:23 UTC 2022


On Thu, 29 Sep 2022 23:14:49 GMT, Zhao Song <duke at openjdk.org> wrote:

> Do not update comment if the comment already exists.

Please note: the update action not only occurs when the pull request toggle between `ready` and `not ready`. The comment will change when the methods `getMergeReadyComment` and `getMergeNoLongerReadyComment` are revised. And the method `getMergeReadyComment` may return different results when it is invoked multi-times.

bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckRun.java line 935:

> 933:             } else {
> 934:                 log.info("Updating merge ready comment");
> 935:                 pr.updateComment(existing.get().id(), message);

This update action needs to be adjusted too.

bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckRun.java line 944:

> 942:             } else {
> 943:                 log.info("No longer ready comment already exists, no need to update the comment");
> 944:             }

The logs should reflect that the existing comment is not equal to the new comment. Because we may change the content of the `no longer ready comment` or the `merge ready comment` in the future. Then the `pr.updateComment` is invoked, but it is not because of `Updating merge ready comment as no longer ready`.

-------------

Changes requested by gli (Committer).

PR: https://git.openjdk.org/skara/pull/1386


More information about the skara-dev mailing list