@@ -344,6 +344,7 @@ type BranchRules struct {
344344 TagNamePattern []* PatternBranchRule
345345 Workflows []* WorkflowsBranchRule
346346 CodeScanning []* CodeScanningBranchRule
347+ CopilotCodeReview []* CopilotCodeReviewBranchRule
347348
348349 // Push target rules.
349350 FileExtensionRestriction []* FileExtensionRestrictionBranchRule
@@ -431,6 +432,12 @@ type CodeScanningBranchRule struct {
431432 Parameters CodeScanningRuleParameters `json:"parameters"`
432433}
433434
435+ // CopilotCodeReviewBranchRule represents a copilot code review branch rule.
436+ type CopilotCodeReviewBranchRule struct {
437+ BranchRuleMetadata
438+ Parameters CopilotCodeReviewRuleParameters `json:"parameters"`
439+ }
440+
434441// EmptyRuleParameters represents the parameters for a rule with no options.
435442type EmptyRuleParameters struct {}
436443
@@ -542,7 +549,7 @@ type CodeScanningRuleParameters struct {
542549
543550// CopilotCodeReviewRuleParameters represents the copilot_code_review rule parameters.
544551type CopilotCodeReviewRuleParameters struct {
545- ReviewNewPushes bool `json:"review_new_pushes "`
552+ ReviewOnPush bool `json:"review_on_push "`
546553 ReviewDraftPullRequests bool `json:"review_draft_pull_requests"`
547554}
548555
@@ -1203,6 +1210,16 @@ func (r *BranchRules) UnmarshalJSON(data []byte) error {
12031210 }
12041211
12051212 r .CodeScanning = append (r .CodeScanning , & CodeScanningBranchRule {BranchRuleMetadata : w .BranchRuleMetadata , Parameters : * params })
1213+ case RulesetRuleTypeCopilotCodeReview :
1214+ params := & CopilotCodeReviewRuleParameters {}
1215+
1216+ if w .Parameters != nil {
1217+ if err := json .Unmarshal (w .Parameters , params ); err != nil {
1218+ return err
1219+ }
1220+ }
1221+
1222+ r .CopilotCodeReview = append (r .CopilotCodeReview , & CopilotCodeReviewBranchRule {BranchRuleMetadata : w .BranchRuleMetadata , Parameters : * params })
12061223 }
12071224 }
12081225
0 commit comments