Skip to content

Fix ghe.com source handling in migrate-repo - #1606

Draft
brianaj wants to merge 7 commits into
mainfrom
1604-fix-source-url
Draft

Fix ghe.com source handling in migrate-repo#1606
brianaj wants to merge 7 commits into
mainfrom
1604-fix-source-url

Conversation

@brianaj

@brianaj brianaj commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1604

What

Two small fixes for migrations that use a GitHub Enterprise Cloud with data residency (ghe.com) source via --github-source-api-url:

  1. Migration source URL — the created migration source now uses the tenant URL (e.g. https://<tenant>.ghe.com) instead of always https://github.com. This is cosmetic and did not affect migrations.
  2. Storage warning — the GitHub Enterprise Server (GHES) Management Console warning no longer shows for ghe.com sources (they have no Management Console). When --use-github-storage is passed, the CLI now notes the flag isn't required for ghe.com sources unless you are supplying your own archives.

Why

Reported in #1604: the source URL was hardcoded to github.com, and the GHES-specific storage warning surfaced on a source where it doesn't apply.

Changes

  • Added a shared ExtractGitHubBaseUrl string extension that handles both GHES (.../api/v3) and ghe.com (api.<host>) URL shapes; replaced the private helper in the migrate-repo handler.
  • CreateGhecMigrationSource now accepts an optional source URL (via an overload); the handler passes the tenant base URL for ghe.com sources.
  • Gated the GHES Management Console warning and added a ghe.com-specific advisory.

Testing

  • Unit tests added/updated for the extension, CreateGhecMigrationSource, and the migrate-repo handler. Full suite passing.
  • Verified end-to-end against a ghe.com source, with and without --use-github-storage: the migration source uses the tenant URL and the storage warning behaves correctly in both cases.

Release notes

Added two entries to RELEASENOTES.md.

  • Did you write/update appropriate tests
  • Release notes updated (if appropriate)
  • Appropriate logging output
  • Issue linked
  • Docs updated (or issue created)
  • New package licenses are added to ThirdPartyNotices.txt (if applicable)

@brianaj brianaj changed the title 1604 fix source url Fix ghe.com source handling in migrate-repo Aug 25, 2026
@brianaj
brianaj requested a balanced review from Copilot August 25, 2026 21:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes ghe.com source URL registration and storage-warning behavior in migrate-repo.

Changes:

  • Extracts tenant base URLs from GHES/ghe.com API URLs.
  • Registers ghe.com migration sources with their tenant URL.
  • Adds source-specific storage guidance and tests.
Show a summary per file
File Description
RELEASENOTES.md Documents user-facing fixes.
src/Octoshift/Extensions/StringExtensions.cs Adds base URL extraction.
src/Octoshift/Services/GithubApi.cs Supports custom migration source URLs.
src/gei/Commands/MigrateRepo/MigrateRepoCommandHandler.cs Applies tenant URLs and source-specific warnings.
src/OctoshiftCLI.Tests/StringExtensionsTests.cs Tests URL extraction.
src/OctoshiftCLI.Tests/Octoshift/Services/GithubApiTests.cs Tests custom source URL payloads.
src/OctoshiftCLI.Tests/gei/Commands/MigrateRepo/MigrateRepoCommandHandlerTests.cs Tests ghe.com handler behavior.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Suppressed comments (1)

src/gei/Commands/MigrateRepo/MigrateRepoCommandHandler.cs:437

  • This guidance is inaccurate for archive URLs: those URLs are already hosted, and argument validation rejects --use-github-storage with only --git-archive-url/--metadata-archive-url (MigrateRepoCommandArgs.cs:98-107). The flag is applicable to on-disk archive paths, not archive URLs. Please remove that case from the warning.
                _log.LogWarning("The --use-github-storage flag is not required when migrating from GitHub Enterprise Cloud with data residency (ghe.com); the migration API handles storage. Only pass it if you are supplying your own archives via archive URLs or on-disk archive paths.");
  • Files reviewed: 7/7 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread RELEASENOTES.md Outdated
Comment thread src/OctoshiftCLI.Tests/gei/Commands/MigrateRepo/MigrateRepoCommandHandlerTests.cs Outdated
Comment thread src/gei/Commands/MigrateRepo/MigrateRepoCommandHandler.cs Outdated
@github-actions

Copy link
Copy Markdown

Unit Test Results

    1 files      1 suites   25s ⏱️
1 163 tests 1 163 ✅ 0 💤 0 ❌
1 164 runs  1 164 ✅ 0 💤 0 ❌

Results for commit bc569e5.

@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Complexity Health
gei 81% 74% 688
gl2gh 77% 70% 417
bbs2gh 83% 78% 668
ado2gh 71% 70% 749
Octoshift 80% 70% 2000
Summary 79% (8912 / 11290) 72% (2284 / 3177) 4522

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.

GHE.com source: createMigrationSource registers https://github.com instead of the tenant URL (v1.32.0)

2 participants