Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions github/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ type MigrationOptions struct {
// ExcludeAttachments indicates whether attachments should be excluded from
// the migration (to reduce migration archive file size).
ExcludeAttachments bool

// ExcludeReleases indicates whether releases should be excluded from
// the migration (to reduce migration archive file size).
ExcludeReleases bool

// Exclude is a slice of related items to exclude from the response in order
// to improve performance of the request. Supported values are: "repositories"
Exclude []string
}

// startMigration represents the body of a StartMigration request.
Expand All @@ -69,6 +77,14 @@ type startMigration struct {
// ExcludeAttachments indicates whether attachments should be excluded from
// the migration (to reduce migration archive file size).
ExcludeAttachments *bool `json:"exclude_attachments,omitempty"`

// ExcludeReleases indicates whether releases should be excluded from
// the migration (to reduce migration archive file size).
ExcludeReleases *bool `json:"exclude_releases,omitempty"`

// Exclude is a slice of related items to exclude from the response in order
// to improve performance of the request. Supported values are: "repositories"
Exclude []string `json:"exclude,omitempty"`
}

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

req, err := s.client.NewRequest("POST", u, body)
Expand Down
2 changes: 2 additions & 0 deletions github/migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ func TestMigrationService_StartMigration(t *testing.T) {
opt := &MigrationOptions{
LockRepositories: true,
ExcludeAttachments: false,
ExcludeReleases: true,
Exclude: []string{"repositories"},
}
ctx := context.Background()
got, _, err := client.Migrations.StartMigration(ctx, "o", []string{"r"}, opt)
Expand Down
Loading