8000 feat: Add organization migration options by leo-belanger · Pull Request #3606 · google/go-github · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Add organization migration options #3606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

8000

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 27, 2025

Conversation

leo-belanger
Copy link
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)
}   

Copy link
google-cla bot commented Jun 27, 2025

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.

@gmlewis gmlewis changed the title feat: add organization migration options feat: Add organization migration options Jun 27, 2025
@gmlewis
Copy link
Collaborator
gmlewis commented Jun 27, 2025

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

Copy link
codecov bot commented Jun 27, 2025

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
Contributor Author

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

@gmlewis Already done :)

Copy link
Collaborator
@gmlewis gmlewis left a comment

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:master Jun 27, 2025
7 checks passed
Sign up for free to 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
0