Skip to content

feat: Add organization migration options - #3606

Merged
gmlewis merged 4 commits into
google:masterfrom
leo-belanger:org-migration-options
Jun 27, 2025
Merged

feat: Add organization migration options#3606
gmlewis merged 4 commits into
google:masterfrom
leo-belanger:org-migration-options

Conversation

@leo-belanger

Copy link
Copy Markdown
Contributor

Implements #3597

Add support for two options of the migrate organization endpoint:

  • ExcludeReleases
  • Exclude

Here are a couple of manual test scenarios

Exclude repositories from response

func Test_ExcludeRepositories(t *testing.T) {
client := github.NewClient(nil).WithAuthToken("GITHUB_AUTH_TOKEN")
m, _, err := client.Migrations.StartMigration(context.Background(), "GITHUB_ORG", []string{"GITHUB_ORG_REPO"}, &github.MigrationOptions{
Exclude: []string{"repositories"},
})
assert.NoError(t, err)
assert.Empty(t, m.Repositories)
}

Exclude releases from response

func Test_ExcludeReleases(t *testing.T) {
client := github.NewClient(nil).WithAuthToken("GITHUB_AUTH_TOKEN")
m, _, err := client.Migrations.StartMigration(context.Background(), "GITHUB_ORG", []string{"GITHUB_ORG_REPO"}, &github.MigrationOptions{
ExcludeReleases: true,
})
assert.NoError(t, err)
url, err := client.Migrations.MigrationArchiveURL(context.Background(), "GITHUB_ORG", m.GetID())
assert.NoError(t, err)
fmt.Println(url)
// Then download the tarball and confirm that the releases were not migrated
// There sould be no `releases_*.json` file
}

Without new options (regression testing)

func Test_Regression(t *testing.T) {
client := github.NewClient(nil).WithAuthToken("GITHUB_AUTH_TOKEN")
_, _, err := client.Migrations.StartMigration(context.Background(), "GITHUB_ORG", []string{"GITHUB_ORG_REPO"}, &github.MigrationOptions{})
assert.NoError(t, err)
} 

@google-cla

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gmlewisgmlewis changed the title feat: add organization migration optionsfeat: Add organization migration optionsJun 27, 2025
@gmlewis

Copy link
Copy Markdown
Collaborator

Please run step 4 of CONTRIBUTING.md and push the changes to this PR.
Thank you, @leo-belanger!

@codecov

codecovBot commented Jun 27, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.32%. Comparing base (ad671c4) to head (b8d629e).
Report is 8 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@## master #3606 +/- ##
=======================================
Coverage 91.32% 91.32% =======================================
Files 184 184 Lines 16143 16148 +5 =======================================
+ Hits 14742 14747 +5 
Misses 1227 1227 Partials 174 174 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leo-belanger

Copy link
Copy Markdown
ContributorAuthor

Please run step 4 of CONTRIBUTING.md and push the changes to this PR. Thank you, @leo-belanger!

@gmlewis Already done :)

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @leo-belanger!
LGTM.
Merging.

@gmlewis
gmlewis merged commit 5862e24 into google:masterJun 27, 2025
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@leo-belanger@gmlewis