Repository: google/go-github
Pull request #1883 (2021-06-05 11:30:35)

Add ListOptions to ListSelectedReposForOrgSecret
Fixes: #1882.

codecov[bot]: # [Codecov](https://codecov.io/gh/google/go-github/pull/1883?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
> Merging [#1883](https://codecov.io/gh/google/go-github/pull/1883?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (47afd73) into [master](https://codecov.io/gh/google/go-github/commit/8751f3d7d27dac2fbfaf2385f87a76260cfc3d77?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (8751f3d) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/google/go-github/pull/1883/graphs/tree.svg?width=650&height=150&src=pr&token=EgYjGjZlI0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)](https://codecov.io/gh/google/go-github/pull/1883?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)

```diff
@@           Coverage Diff           @@
##           master    #1883   +/-   ##
=======================================
  Coverage   97.65%   97.65%           
=======================================
  Files         105      105           
  Lines        6783     6786    +3     
=======================================
+ Hits         6624     6627    +3     
  Misses         86       86           
  Partials       73       73           
```


| [Impacted Files](https://codecov.io/gh/google/go-github/pull/1883?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) | Coverage Δ | |
|---|---|---|
| [github/actions\_secrets.go](https://codecov.io/gh/google/go-github/pull/1883/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google#diff-Z2l0aHViL2FjdGlvbnNfc2VjcmV0cy5nbw==) | `100.00% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/google/go-github/pull/1883?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/google/go-github/pull/1883?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Last update [8751f3d...47afd73](https://codecov.io/gh/google/go-github/pull/1883?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).


Patch:
diff --git a/github/actions_secrets.go b/github/actions_secrets.go
index 4763d3a1..379eab81 100644
--- a/github/actions_secrets.go
+++ b/github/actions_secrets.go
@@ -274,8 +274,13 @@ type SelectedReposList struct {
 // ListSelectedReposForOrgSecret lists all repositories that have access to a secret.
 //
 // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#list-selected-repositories-for-an-organization-secret
-func (s *ActionsService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string) (*SelectedReposList, *Response, error) {
+func (s *ActionsService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) {
 	u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name)
+	u, err := addOptions(u, opts)
+	if err != nil {
+		return nil, nil, err
+	}
+
 	req, err := s.client.NewRequest("GET", u, nil)
 	if err != nil {
 		return nil, nil, err
diff --git a/github/github-accessors.go b/github/github-accessors.go
index cb068a69..1c17384e 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -14764,6 +14764,14 @@ func (t *TemplateRepoRequest) GetDescription() string {
 	return *t.Description
 }
 
+// GetIncludeAllBranches returns the IncludeAllBranches field if it's non-nil, zero value otherwise.
+func (t *TemplateRepoRequest) GetIncludeAllBranches() bool {
+	if t == nil || t.IncludeAllBranches == nil {
+		return false
+	}
+	return *t.IncludeAllBranches
+}
+
 // GetName returns the Name field if it's non-nil, zero value otherwise.
 func (t *TemplateRepoRequest) GetName() string {
 	if t == nil || t.Name == nil {
diff --git a/github/repos.go b/github/repos.go
index 73e05f23..8f34cf8b 100644
--- a/github/repos.go
+++ b/github/repos.go
@@ -385,7 +385,8 @@ type TemplateRepoRequest struct {
 	Owner       *string `json:"owner,omitempty"`
 	Description *string `json:"description,omitempty"`
 
-	Private *bool `json:"private,omitempty"`
+	IncludeAllBranches *bool `json:"include_all_branches,omitempty"`
+	Private            *bool `json:"private,omitempty"`
 }
 
 // CreateFromTemplate generates a repository from a template.


Test patch:
diff --git a/github/actions_secrets_test.go b/github/actions_secrets_test.go
index 4e7ca87f..e38836ab 100644
--- a/github/actions_secrets_test.go
+++ b/github/actions_secrets_test.go
@@ -466,8 +466,9 @@ func TestActionsService_ListSelectedReposForOrgSecret(t *testing.T) {
 		fmt.Fprintf(w, `{"total_count":1,"repositories":[{"id":1}]}`)
 	})
 
+	opts := &ListOptions{Page: 2, PerPage: 2}
 	ctx := context.Background()
-	repos, _, err := client.Actions.ListSelectedReposForOrgSecret(ctx, "o", "NAME")
+	repos, _, err := client.Actions.ListSelectedReposForOrgSecret(ctx, "o", "NAME", opts)
 	if err != nil {
 		t.Errorf("Actions.ListSelectedReposForOrgSecret returned error: %v", err)
 	}
@@ -484,12 +485,12 @@ func TestActionsService_ListSelectedReposForOrgSecret(t *testing.T) {
 
 	const methodName = "ListSelectedReposForOrgSecret"
 	testBadOptions(t, methodName, func() (err error) {
-		_, _, err = client.Actions.ListSelectedReposForOrgSecret(ctx, "\n", "\n")
+		_, _, err = client.Actions.ListSelectedReposForOrgSecret(ctx, "\n", "\n", opts)
 		return err
 	})
 
 	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
-		got, resp, err := client.Actions.ListSelectedReposForOrgSecret(ctx, "o", "NAME")
+		got, resp, err := client.Actions.ListSelectedReposForOrgSecret(ctx, "o", "NAME", opts)
 		if got != nil {
 			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
 		}
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 5695e3fb..750c6a40 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -17292,6 +17292,16 @@ func TestTemplateRepoRequest_GetDescription(tt *testing.T) {
 	t.GetDescription()
 }
 
+func TestTemplateRepoRequest_GetIncludeAllBranches(tt *testing.T) {
+	var zeroValue bool
+	t := &TemplateRepoRequest{IncludeAllBranches: &zeroValue}
+	t.GetIncludeAllBranches()
+	t = &TemplateRepoRequest{}
+	t.GetIncludeAllBranches()
+	t = nil
+	t.GetIncludeAllBranches()
+}
+
 func TestTemplateRepoRequest_GetName(tt *testing.T) {
 	var zeroValue string
 	t := &TemplateRepoRequest{Name: &zeroValue}