@@ -97,6 +97,19 @@ type RequiredStatusChecksRuleParameters struct {
9797 StrictRequiredStatusChecksPolicy bool `json:"strict_required_status_checks_policy"`
9898}
9999
100+ // RuleRequiredWorkflow represents the Workflow for the RequireWorkflowsRuleParameters object.
101+ type RuleRequiredWorkflow struct {
102+ Path string `json:"path"`
103+ Ref * string `json:"ref,omitempty"`
104+ RepositoryID * int64 `json:"repository_id,omitempty"`
105+ Sha * string `json:"sha,omitempty"`
106+ }
107+
108+ // RequiredWorkflowsRuleParameters represents the workflows rule parameters.
109+ type RequiredWorkflowsRuleParameters struct {
110+ RequiredWorkflows []* RuleRequiredWorkflow `json:"workflows"`
111+ }
112+
100113// RepositoryRule represents a GitHub Rule.
101114type RepositoryRule struct {
102115 Type string `json:"type"`
@@ -171,6 +184,16 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error {
171184 bytes , _ := json .Marshal (params )
172185 rawParams := json .RawMessage (bytes )
173186
187+ r .Parameters = & rawParams
188+ case "workflows" :
189+ params := RequiredWorkflowsRuleParameters {}
190+ if err := json .Unmarshal (* RepositoryRule .Parameters , & params ); err != nil {
191+ return err
192+ }
193+
194+ bytes , _ := json .Marshal (params )
195+ rawParams := json .RawMessage (bytes )
196+
174197 r .Parameters = & rawParams
175198 default :
176199 r .Type = ""
@@ -329,6 +352,18 @@ func NewTagNamePatternRule(params *RulePatternParameters) (rule *RepositoryRule)
329352 }
330353}
331354
355+ // NewRequiredWorkflowsRule creates a rule to require which status checks must pass before branches can be merged into a branch rule.
356+ func NewRequiredWorkflowsRule (params * RequiredWorkflowsRuleParameters ) (rule * RepositoryRule ) {
357+ bytes , _ := json .Marshal (params )
358+
359+ rawParams := json .RawMessage (bytes )
360+
361+ return & RepositoryRule {
362+ Type : "workflows" ,
363+ Parameters : & rawParams ,
364+ }
365+ }
366+
332367// Ruleset represents a GitHub ruleset object.
333368type Ruleset struct {
334369 ID * int64 `json:"id,omitempty"`
0 commit comments