Repository: google/go-github (go)

Issue:
List User Migrations: Add support for pagination
The [ListUserMigrations()](https://github.com/google/go-github/blob/3a432d62bf0318c14b2d1d7415bf94ea1a884342/github/migrations_user.go#L100) currently doesn't support pagination options.

We should add it.

PS: Will be creating a pull request shortly.

Pull request description:
Add ListOptions for listing user migrations
Fix for https://github.com/google/go-github/issues/2416

Patch:
diff --git a/example/migrations/main.go b/example/migrations/main.go
index ff7d3976..ae098f99 100644
--- a/example/migrations/main.go
+++ b/example/migrations/main.go
@@ -24,7 +24,7 @@ func fetchAllUserMigrations() ([]*github.UserMigration, error) {
 	tc := oauth2.NewClient(ctx, ts)
 	client := github.NewClient(tc)
 
-	migrations, _, err := client.Migrations.ListUserMigrations(ctx)
+	migrations, _, err := client.Migrations.ListUserMigrations(ctx, &github.ListOptions{Page: 1})
 	return migrations, err
 }
 
diff --git a/github/migrations_user.go b/github/migrations_user.go
index b8a0d608..6586fdb2 100644
--- a/github/migrations_user.go
+++ b/github/migrations_user.go
@@ -97,8 +97,12 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin
 // ListUserMigrations lists the most recent migrations.
 //
 // GitHub API docs: https://docs.github.com/en/rest/migrations/users#list-user-migrations
-func (s *MigrationService) ListUserMigrations(ctx context.Context) ([]*UserMigration, *Response, error) {
+func (s *MigrationService) ListUserMigrations(ctx context.Context, opts *ListOptions) ([]*UserMigration, *Response, error) {
 	u := "user/migrations"
+	u, err := addOptions(u, opts)
+	if err != nil {
+		return nil, nil, err
+	}
 
 	req, err := s.client.NewRequest("GET", u, nil)
 	if err != nil {


Test patch:
diff --git a/github/migrations_user_test.go b/github/migrations_user_test.go
index 5a8905cd..358bb9bd 100644
--- a/github/migrations_user_test.go
+++ b/github/migrations_user_test.go
@@ -66,7 +66,7 @@ func TestMigrationService_ListUserMigrations(t *testing.T) {
 	})
 
 	ctx := context.Background()
-	got, _, err := client.Migrations.ListUserMigrations(ctx)
+	got, _, err := client.Migrations.ListUserMigrations(ctx, &ListOptions{Page: 1, PerPage: 2})
 	if err != nil {
 		t.Errorf("ListUserMigrations returned error %v", err)
 	}
@@ -78,7 +78,7 @@ func TestMigrationService_ListUserMigrations(t *testing.T) {
 
 	const methodName = "ListUserMigrations"
 	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
-		got, resp, err := client.Migrations.ListUserMigrations(ctx)
+		got, resp, err := client.Migrations.ListUserMigrations(ctx, &ListOptions{Page: 1, PerPage: 2})
 		if got != nil {
 			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
 		}