RFR: 1830: Support wildcard branch protection with prbranches

Erik Joelsson erikj at openjdk.org
Mon Mar 20 22:52:39 UTC 2023


On Mon, 20 Mar 2023 21:56:22 GMT, Zhao Song <zsong 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.

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.

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

PR Review Comment: https://git.openjdk.org/skara/pull/1489#discussion_r1142738696
PR Review Comment: https://git.openjdk.org/skara/pull/1489#discussion_r1142739478


More information about the skara-dev mailing list