@@ -79,6 +79,11 @@ type RulePatternParameters struct {
7979 Pattern string `json:"pattern"`
8080}
8181
82+ // RuleFileParameters represents a list of file paths.
83+ type RuleFileParameters struct {
84+ RestrictedFilePaths * []string `json:"restricted_file_paths"`
85+ }
86+
8287// UpdateAllowsFetchAndMergeRuleParameters represents the update rule parameters.
8388type UpdateAllowsFetchAndMergeRuleParameters struct {
8489 UpdateAllowsFetchAndMerge bool `json:"update_allows_fetch_and_merge"`
@@ -213,6 +218,15 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error {
213218 bytes , _ := json .Marshal (params )
214219 rawParams := json .RawMessage (bytes )
215220
221+ r .Parameters = & rawParams
222+ case "file_path_restriction" :
223+ params := RuleFileParameters {}
224+ if err := json .Unmarshal (* RepositoryRule .Parameters , & params ); err != nil {
225+ return err
226+ }
227+ bytes , _ := json .Marshal (params )
228+ rawParams := json .RawMessage (bytes )
229+
216230 r .Parameters = & rawParams
217231 default :
218232 r .Type = ""
@@ -390,6 +404,18 @@ func NewRequiredWorkflowsRule(params *RequiredWorkflowsRuleParameters) (rule *Re
390404 }
391405}
392406
407+ // NewFilePathRestrictionRule creates a rule to restrict file paths from being pushed to.
408+ func NewFilePathRestrictionRule (params * RuleFileParameters ) (rule * RepositoryRule ) {
409+ bytes , _ := json .Marshal (params )
410+
411+ rawParams := json .RawMessage (bytes )
412+
413+ return & RepositoryRule {
414+ Type : "file_path_restriction" ,
415+ Parameters : & rawParams ,
416+ }
417+ }
418+
393419// Ruleset represents a GitHub ruleset object.
394420type Ruleset struct {
395421 ID * int64 `json:"id,omitempty"`
0 commit comments