mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-02 15:39:42 +00:00
feat: Add block on pending codeowner reviews branch protection (#34995)
This commit introduces a new branch protection rule that allows merge blocking if there are pending reviews from one or more code owners (as defined in any valid `CODEOWNERS` file). This is determined by evaluating each rule present in the `CODEOWNERS` file individually. For every rule, at least one named code owner (or member of a code owner team) must have given an approving review for merging to be possible. Closes #32602 --- This PR does NOT display code owners separately from other reviewers (#28137) ### Screenshot <details> <summary>Pull Request</summary> <img src="https://github.com/user-attachments/assets/74560f9c-9f59-477a-b270-63f937b26d6a" /> </details> <details> <summary>Branch Protection Rule</summary> <img src="https://github.com/user-attachments/assets/f0a9ce00-38fe-4eed-b6a3-5290aa404610" /> </details> Doc PR https://gitea.com/gitea/docs/pulls/245 --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: bircni <bircni@icloud.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -61,6 +61,7 @@ type BranchProtection struct {
|
||||
ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams"`
|
||||
BlockOnRejectedReviews bool `json:"block_on_rejected_reviews"`
|
||||
BlockOnOfficialReviewRequests bool `json:"block_on_official_review_requests"`
|
||||
BlockOnCodeownerReviews bool `json:"block_on_codeowner_reviews"`
|
||||
BlockOnOutdatedBranch bool `json:"block_on_outdated_branch"`
|
||||
DismissStaleApprovals bool `json:"dismiss_stale_approvals"`
|
||||
IgnoreStaleApprovals bool `json:"ignore_stale_approvals"`
|
||||
@@ -104,6 +105,7 @@ type CreateBranchProtectionOption struct {
|
||||
ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams"`
|
||||
BlockOnRejectedReviews bool `json:"block_on_rejected_reviews"`
|
||||
BlockOnOfficialReviewRequests bool `json:"block_on_official_review_requests"`
|
||||
BlockOnCodeownerReviews bool `json:"block_on_codeowner_reviews"`
|
||||
BlockOnOutdatedBranch bool `json:"block_on_outdated_branch"`
|
||||
DismissStaleApprovals bool `json:"dismiss_stale_approvals"`
|
||||
IgnoreStaleApprovals bool `json:"ignore_stale_approvals"`
|
||||
@@ -140,6 +142,7 @@ type EditBranchProtectionOption struct {
|
||||
ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams"`
|
||||
BlockOnRejectedReviews *bool `json:"block_on_rejected_reviews"`
|
||||
BlockOnOfficialReviewRequests *bool `json:"block_on_official_review_requests"`
|
||||
BlockOnCodeownerReviews *bool `json:"block_on_codeowner_reviews"`
|
||||
BlockOnOutdatedBranch *bool `json:"block_on_outdated_branch"`
|
||||
DismissStaleApprovals *bool `json:"dismiss_stale_approvals"`
|
||||
IgnoreStaleApprovals *bool `json:"ignore_stale_approvals"`
|
||||
|
||||
Reference in New Issue
Block a user