From 2782c1439679402a1f8731a94dc66214781282ba Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 16 Jan 2023 16:00:22 +0800 Subject: Supports wildcard protected branch (#20825) This PR introduce glob match for protected branch name. The separator is `/` and you can use `*` matching non-separator chars and use `**` across separator. It also supports input an exist or non-exist branch name as matching condition and branch name condition has high priority than glob rule. Should fix #2529 and #15705 screenshots image Co-authored-by: zeripath --- services/asymkey/sign.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'services/asymkey') diff --git a/services/asymkey/sign.go b/services/asymkey/sign.go index 227e0bbf33..01718ebe77 100644 --- a/services/asymkey/sign.go +++ b/services/asymkey/sign.go @@ -310,7 +310,7 @@ Loop: return false, "", nil, &ErrWontSign{twofa} } case approved: - protectedBranch, err := git_model.GetProtectedBranchBy(ctx, repo.ID, pr.BaseBranch) + protectedBranch, err := git_model.GetFirstMatchProtectedBranchRule(ctx, repo.ID, pr.BaseBranch) if err != nil { return false, "", nil, err } -- cgit v1.2.3