Repository: google/go-github (go)

Issue:
Missing ListOptions in ListRepositoryAccessRunnerGroup
Based on [API document](https://docs.github.com/en/rest/reference/actions#list-repository-access-to-a-self-hosted-runner-group-in-an-organization) this API call has pagination mechanism implemented.

However with current implementation the [ListRepositoryAccessRunnerGroup](https://github.com/google/go-github/blob/b338ce623f50aeaf4cbf7f4195a79d0d302f9a65/github/actions_runner_groups.go#L159) function doesn't have ListOptions to be passed in. Therefore it will only return first 30 repositories in the access list.

ListOptions needs to be supported so that it can fetch the full list of repositories that can access a self-hosted runner group.

Pull request:
Add List Options for ListRepositoryAccessRunnerGroup
Fix #2085 . Add List Options for ListRepositoryAccessRunnerGroup to support fetching full list of access repositories. Also update unit tests accordingly.

Patch:
diff --git a/github/actions_runner_groups.go b/github/actions_runner_groups.go
index e34495a9..2d6a1546 100644
--- a/github/actions_runner_groups.go
+++ b/github/actions_runner_groups.go
@@ -159,8 +159,13 @@ func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org
 // ListRepositoryAccessRunnerGroup lists the repositories with access to a self-hosted runner group configured in an organization.
 //
 // GitHub API docs: https://docs.github.com/en/rest/reference/actions#list-repository-access-to-a-self-hosted-runner-group-in-an-organization
-func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64) (*ListRepositories, *Response, error) {
+func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, opts *ListOptions) (*ListRepositories, *Response, error) {
 	u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories", org, groupID)
+	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


Test patch:
diff --git a/github/actions_runner_groups_test.go b/github/actions_runner_groups_test.go
index 55de0b93..1ec958a1 100644
--- a/github/actions_runner_groups_test.go
+++ b/github/actions_runner_groups_test.go
@@ -234,11 +234,13 @@ func TestActionsService_ListRepositoryAccessRunnerGroup(t *testing.T) {
 
 	mux.HandleFunc("/orgs/o/actions/runner-groups/2/repositories", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
+		testFormValues(t, r, values{"per_page": "1", "page": "1"})
 		fmt.Fprint(w, `{"total_count": 1, "repositories": [{"id": 43, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "full_name": "octocat/Hello-World"}]}`)
 	})
 
 	ctx := context.Background()
-	groups, _, err := client.Actions.ListRepositoryAccessRunnerGroup(ctx, "o", 2)
+	opts := &ListOptions{Page: 1, PerPage: 1}
+	groups, _, err := client.Actions.ListRepositoryAccessRunnerGroup(ctx, "o", 2, opts)
 	if err != nil {
 		t.Errorf("Actions.ListRepositoryAccessRunnerGroup returned error: %v", err)
 	}
@@ -255,12 +257,12 @@ func TestActionsService_ListRepositoryAccessRunnerGroup(t *testing.T) {
 
 	const methodName = "ListRepositoryAccessRunnerGroup"
 	testBadOptions(t, methodName, func() (err error) {
-		_, _, err = client.Actions.ListRepositoryAccessRunnerGroup(ctx, "\n", 2)
+		_, _, err = client.Actions.ListRepositoryAccessRunnerGroup(ctx, "\n", 2, opts)
 		return err
 	})
 
 	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
-		got, resp, err := client.Actions.ListRepositoryAccessRunnerGroup(ctx, "o", 2)
+		got, resp, err := client.Actions.ListRepositoryAccessRunnerGroup(ctx, "o", 2, opts)
 		if got != nil {
 			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
 		}