RFR: 1852: Make it possible to disable backport PRs for repository [v2]

Erik Joelsson erikj at openjdk.org
Wed Apr 12 20:28:51 UTC 2023


On Wed, 12 Apr 2023 20:25:36 GMT, Zhao Song <zsong at openjdk.org> wrote:

>> In this patch, PR bot has been added with the capability to control whether backport pr is allowed in specific repositories.
>> 
>> By default, backport is enabled.
>> 
>> However, if it is desired to disable backport in a repo, the configuration can be added to the PR bot configuration as follows:
>> 
>> {
>>   "pr": {
>>       "repositories": {
>>           "repo1": {
>>                "backport": false
>>           }
>>        }
>>   }
>> }
>> 
>> 
>> If backport pr is disabled and the title of the pr matches the pattern of backport pr, the pr bot would reply a warning message to the user and prompt for the next steps.
>
> Zhao Song has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits:
> 
>  - fix a problem
>  - fix problems
>  - Merge branch 'master' into SKARA-1852
>    
>    # Conflicts:
>    #	bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckWorkItem.java
>    #	bots/pr/src/main/java/org/openjdk/skara/bots/pr/PullRequestBot.java
>    #	bots/pr/src/main/java/org/openjdk/skara/bots/pr/PullRequestBotBuilder.java
>    #	bots/pr/src/main/java/org/openjdk/skara/bots/pr/PullRequestBotFactory.java
>    #	bots/pr/src/test/java/org/openjdk/skara/bots/pr/CheckTests.java
>    #	bots/pr/src/test/java/org/openjdk/skara/bots/pr/PullRequestBotFactoryTest.java
>  - Update bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckWorkItem.java
>    
>    Co-authored-by: Erik Joelsson <37597443+erikj79 at users.noreply.github.com>
>  - fix a problem
>  - SKARA-1852

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

> 296:             var backportDisabledText = "<!-- backport error -->\n" +
> 297:                     ":warning: @" + pr.author().username() + " backport PR is not allowed in this repository, please close this pr." +
> 298:                     " If it was unintentional, please modify the title of this PR.";

Suggestion:

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

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

> 303:             }
> 304: 
> 305:             removeErrorComment(backportDisabledText, comments);

No need to remove the comment.

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

PR Review Comment: https://git.openjdk.org/skara/pull/1497#discussion_r1164549602
PR Review Comment: https://git.openjdk.org/skara/pull/1497#discussion_r1164549836


More information about the skara-dev mailing list