RFR: 1823: Mailing list bot should include link to comment on the Git forge [v4]

Erik Joelsson erikj at openjdk.org
Tue Feb 21 20:45:56 UTC 2023


On Tue, 21 Feb 2023 16:56:35 GMT, Zhao Song <zsong at openjdk.org> wrote:

>> This patch will add the ability to attach comment/reviewComment/review link to the email generated by mlbridge bot
>> 
>> The implementation for GitHub is straightforward, we can extract the URL for a specific comment or review from the JSON response using the `html_url` field and include it in the email. 
>> 
>> For GitLab, we will need to generate the URL using the `id` field in `note,` since GitLab does not provide an field like `html_url` in its JSON responses.
>
> Zhao Song has updated the pull request incrementally with one additional commit since the last revision:
> 
>   trigger workflow

bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/ArchiveMessages.java line 308:

> 306:     }
> 307: 
> 308:     static String composeReplyFooter(PullRequest pr, Comment comment, ReviewComment reviewComment, Review review) {

I think you should just split this into 3 separate methods. I can't see any caller that uses more than one of Comment, ReviewComment or Review.

bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/ArchiveMessages.java line 311:

> 309:         var footer = new StringBuilder();
> 310:         if (comment != null) {
> 311:             footer.append("Comment: " + pr.commentUrl(comment).toString());

Suggestion:

            footer.append("PR Comment: " + pr.commentUrl(comment).toString());

bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/ArchiveMessages.java line 314:

> 312:         }
> 313:         if (reviewComment != null) {
> 314:             footer.append("ReviewComment: " + pr.reviewCommentUrl(reviewComment).toString());

Suggestion:

            footer.append("PR Review Comment: " + pr.reviewCommentUrl(reviewComment).toString());

bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/ArchiveMessages.java line 317:

> 315:         }
> 316:         if (review != null) {
> 317:             footer.append("Review: " + pr.reviewUrl(review).toString());

Suggestion:

            footer.append("PR Review: " + pr.reviewUrl(review).toString());

bots/mlbridge/src/main/java/org/openjdk/skara/bots/mlbridge/ReviewArchive.java line 357:

> 355:                                                .filter(line -> !includedFooterFragments.contains(line))
> 356:                                                .collect(Collectors.toList());
> 357:                 if(!footer.isEmpty() && !newFooterFragments.isEmpty()){

Suggestion:

                if (!footer.isEmpty() && !newFooterFragments.isEmpty()) {

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

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


More information about the skara-dev mailing list