MCPcopy Index your code
hub / github.com/google/go-github / GetAllRulesets

Method GetAllRulesets

github/repos_rules.go:197–217  ·  view source on GitHub ↗

GetAllRulesets gets all the repository rulesets for the specified repository. By default, this endpoint will include rulesets configured at the organization or enterprise level that apply to the repository. To exclude those rulesets, set the `RepositoryListRulesetsOptions.IncludesParents` parameter

(ctx context.Context, owner, repo string, opts *RepositoryListRulesetsOptions)

Source from the content-addressed store, hash-verified

195//
196//meta:operation GET /repos/{owner}/{repo}/rulesets
197func (s *RepositoriesService) GetAllRulesets(ctx context.Context, owner, repo string, opts *RepositoryListRulesetsOptions) ([]*RepositoryRuleset, *Response, error) {
198 u := fmt.Sprintf("repos/%v/%v/rulesets", owner, repo)
199
200 u, err := addOptions(u, opts)
201 if err != nil {
202 return nil, nil, err
203 }
204
205 req, err := s.client.NewRequest(ctx, "GET", u, nil)
206 if err != nil {
207 return nil, nil, err
208 }
209
210 var ruleset []*RepositoryRuleset
211 resp, err := s.client.Do(req, &ruleset)
212 if err != nil {
213 return nil, resp, err
214 }
215
216 return ruleset, resp, nil
217}
218
219// CreateRuleset creates a repository ruleset for the specified repository.
220//

Calls 3

addOptionsFunction · 0.85
NewRequestMethod · 0.80
DoMethod · 0.45