ListRulesForBranch gets all the repository rules that apply to the specified branch. GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#get-rules-for-a-branch meta:operation GET /repos/{owner}/{repo}/rules/branches/{branch}
(ctx context.Context, owner, repo, branch string, opts *ListOptions)
| 17 | // |
| 18 | //meta:operation GET /repos/{owner}/{repo}/rules/branches/{branch} |
| 19 | func (s *RepositoriesService) ListRulesForBranch(ctx context.Context, owner, repo, branch string, opts *ListOptions) (*BranchRules, *Response, error) { |
| 20 | u := fmt.Sprintf("repos/%v/%v/rules/branches/%v", owner, repo, branch) |
| 21 | |
| 22 | u, err := addOptions(u, opts) |
| 23 | if err != nil { |
| 24 | return nil, nil, err |
| 25 | } |
| 26 | |
| 27 | req, err := s.client.NewRequest(ctx, "GET", u, nil) |
| 28 | if err != nil { |
| 29 | return nil, nil, err |
| 30 | } |
| 31 | |
| 32 | var rules *BranchRules |
| 33 | resp, err := s.client.Do(req, &rules) |
| 34 | if err != nil { |
| 35 | return nil, resp, err |
| 36 | } |
| 37 | |
| 38 | return rules, resp, nil |
| 39 | } |
| 40 | |
| 41 | // ListRulesForBranchIter returns an iterator that paginates through all results of ListRulesForBranch. |
| 42 | // |