RFR: 1830: Support wildcard branch protection with prbranches

Zhao Song zsong at openjdk.org
Mon Mar 20 22:58:47 UTC 2023


On Mon, 20 Mar 2023 22:32:58 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> In this patch, notifyBot would add wildcard branch protection for the repo, and when the bot tries to delete the pr/* branch, it will temporarily remove wildcard branch protection.
>
> bots/notify/src/main/java/org/openjdk/skara/bots/notify/NotifyBot.java line 92:
> 
>> 90:             repository.protectBranchPattern("*");
>> 91:             wildCardProtected = true;
>> 92:         }
> 
> I would suggest adding a new method on the `PullRequestListener` interface `initialize(HostedRepository)` and implement this method in `PullRequestBranchNotifier` so you can put this logic there instead. Then you can call `initialize` on all listeners when `getPeriodicItems` is called the first time.

Good idea. Will do it.

> bots/notify/src/main/java/org/openjdk/skara/bots/notify/prbranch/PullRequestBranchNotifier.java line 78:
> 
>> 76:         pr.repository().deleteBranch(branch);
>> 77:         log.info("Protecting branch * after deleting branch " + branch);
>> 78:         pr.repository().protectBranchPattern("*");
> 
> We should not be touching branch protection settings unless `protectBranches` is enabled.

Exactly, will fix it.

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

PR Review Comment: https://git.openjdk.org/skara/pull/1489#discussion_r1142750863
PR Review Comment: https://git.openjdk.org/skara/pull/1489#discussion_r1142751382


More information about the skara-dev mailing list