Skip to content

Commit 5862e24

Browse files
authored
feat: Add organization migration options (#3606)
1 parent f1b11e1 commit 5862e24

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

github/migrations.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ type MigrationOptions struct {
5555
// ExcludeAttachments indicates whether attachments should be excluded from
5656
// the migration (to reduce migration archive file size).
5757
ExcludeAttachments bool
58+
59+
// ExcludeReleases indicates whether releases should be excluded from
60+
// the migration (to reduce migration archive file size).
61+
ExcludeReleases bool
62+
63+
// Exclude is a slice of related items to exclude from the response in order
64+
// to improve performance of the request. Supported values are: "repositories"
65+
Exclude []string
5866
}
5967

6068
// startMigration represents the body of a StartMigration request.
@@ -69,6 +77,14 @@ type startMigration struct {
6977
// ExcludeAttachments indicates whether attachments should be excluded from
7078
// the migration (to reduce migration archive file size).
7179
ExcludeAttachments *bool `json:"exclude_attachments,omitempty"`
80+
81+
// ExcludeReleases indicates whether releases should be excluded from
82+
// the migration (to reduce migration archive file size).
83+
ExcludeReleases *bool `json:"exclude_releases,omitempty"`
84+
85+
// Exclude is a slice of related items to exclude from the response in order
86+
// to improve performance of the request. Supported values are: "repositories"
87+
Exclude []string `json:"exclude,omitempty"`
7288
}
7389

7490
// StartMigration starts the generation of a migration archive.
@@ -84,6 +100,8 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos
84100
if opts != nil {
85101
body.LockRepositories = Ptr(opts.LockRepositories)
86102
body.ExcludeAttachments = Ptr(opts.ExcludeAttachments)
103+
body.ExcludeReleases = Ptr(opts.ExcludeReleases)
104+
body.Exclude = append(body.Exclude, opts.Exclude...)
87105
}
88106

89107
req, err := s.client.NewRequest("POST", u, body)

github/migrations_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ func TestMigrationService_StartMigration(t *testing.T) {
3030
opt := &MigrationOptions{
3131
LockRepositories: true,
3232
ExcludeAttachments: false,
33+
ExcludeReleases: true,
34+
Exclude: []string{"repositories"},
3335
}
3436
ctx := context.Background()
3537
got, _, err := client.Migrations.StartMigration(ctx, "o", []string{"r"}, opt)

0 commit comments

Comments
 (0)