RFR: 1853: Make it possible to disable merge PRs for a repository

Erik Joelsson erikj at openjdk.org
Tue Apr 11 18:06:35 UTC 2023


On Mon, 10 Apr 2023 20:16:54 GMT, Zhao Song <zsong at openjdk.org> wrote:

> In this patch, PR bot has been added with the capability to control whether merge-style pr is allowed in specific repositories.
> 
> By default, merge-style pr is enabled.
> 
> However, if it is desired to disable merge-style pr in a repo, the configuration can be added to the PR bot configuration as follows:
> 
> {
>   "pr": {
>       "repositories": {
>           "repo1": {
>                "merge": false
>           }
>        }
>   }
> }
> 
> 
> If merge-style pr is disabled and the title of the pr matches the pattern of merge-style pr, the pr bot would reply a warning message to the user and prompt for the next steps.

bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckWorkItem.java line 258:

> 256:         var mergeDisabledText = "<!-- merge error -->\n" +
> 257:                 ":warning: @" + pr.author().username() + " merge PR is not allowed in this repository, please close this pr." +
> 258:                 " If it was unintentional, please modify the title of this PR.";

Suggestion:

                "⚠ @" + pr.author().username() + " Merge-style pull requests are not allowed in this repository." +
                " If it was unintentional, please modify the title of this PR.";

bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckWorkItem.java line 263:

> 261:             return List.of();
> 262:         }
> 263:         removeErrorComment(mergeDisabledText, comments);

I think this whole check should be moved inside the `currentCheckValid` block. The check is cheap, but I still think it should be grouped with other similar checks.

I don't think we should remove error comments. None of the other similar comments are removed, so unless we want to change that, then this new comment shouldn't be either.

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

PR Review Comment: https://git.openjdk.org/skara/pull/1499#discussion_r1163160354
PR Review Comment: https://git.openjdk.org/skara/pull/1499#discussion_r1163162820


More information about the skara-dev mailing list