Skip to content

Conversation

@kine
Copy link

@kine kine commented Jul 28, 2025

Implements #1398

  • 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)

Copilot AI review requested due to automatic review settings July 28, 2025 13:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for the --target-api-url parameter to the add-team-to-repo command to enable migration to GitHub Enterprise Server (GHES) instances rather than just GitHub.com. The change allows users to specify a custom API URL when adding teams to repositories during migrations.

Key changes:

  • Added --target-api-url parameter to the add-team-to-repo command
  • Updated script generation to include the target API URL parameter when creating team-to-repo assignments
  • Modified the underlying GitHub API service method to accept an optional target API URL parameter

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/ado2gh/Commands/AddTeamToRepo/AddTeamToRepoCommand.cs Added --target-api-url option and updated factory call to use the new parameter
src/ado2gh/Commands/AddTeamToRepo/AddTeamToRepoCommandArgs.cs Added TargetApiUrl property to command arguments
src/ado2gh/Commands/AddTeamToRepo/AddTeamToRepoCommandHandler.cs Updated to pass target API URL to the GitHub API service
src/ado2gh/Commands/GenerateScript/GenerateScriptCommandHandler.cs Modified script generation methods to include target API URL in generated commands
src/Octoshift/Services/GithubApi.cs Added optional targetApiUrl parameter to AddTeamToRepo method
src/OctoshiftCLI.Tests/ado2gh/Commands/AddTeamToRepo/AddTeamToRepoCommandTests.cs Updated test to verify the new option count
src/OctoshiftCLI.Tests/ado2gh/Commands/AddTeamToRepo/AddTeamToRepoCommandHandlerTests.cs Updated test to include null parameter in verification
RELEASENOTES.md Added release note about the new feature
Comments suppressed due to low confidence (1)

RELEASENOTES.md:1

  • The release note mentions --ghes-api-url but the actual parameter name implemented is --target-api-url. This inconsistency could confuse users.
- Added `--ghes-api-url` as an optional arg to the `add-team-to-repo`

public virtual async Task AddTeamToRepo(string org, string repo, string teamSlug, string role)
public virtual async Task AddTeamToRepo(string org, string repo, string teamSlug, string role, string targetApiUrl = null)
{
var url = $"{_apiUrl}/orgs/{org.EscapeDataString()}/teams/{teamSlug.EscapeDataString()}/repos/{org.EscapeDataString()}/{repo.EscapeDataString()}";
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

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

The targetApiUrl parameter is added but never used in the method implementation. The method still uses the instance field _apiUrl instead of the provided targetApiUrl parameter.

Suggested change
var url = $"{_apiUrl}/orgs/{org.EscapeDataString()}/teams/{teamSlug.EscapeDataString()}/repos/{org.EscapeDataString()}/{repo.EscapeDataString()}";
var apiUrl = string.IsNullOrEmpty(targetApiUrl) ? _apiUrl : targetApiUrl;
var url = $"{apiUrl}/orgs/{org.EscapeDataString()}/teams/{teamSlug.EscapeDataString()}/repos/{org.EscapeDataString()}/{repo.EscapeDataString()}";

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

Parameter removed

@github-actions
Copy link

github-actions bot commented Jul 28, 2025

Unit Test Results

  1 files    1 suites   10m 24s ⏱️
968 tests 968 ✅ 0 💤 0 ❌
969 runs  969 ✅ 0 💤 0 ❌

Results for commit 815043d.

♻️ This comment has been updated with latest results.

@kine
Copy link
Author

kine commented Aug 1, 2025

@dylan-smith Are the failing tests problem of my code changes or it is technical problem in the integration tests?

@brianaj
Copy link
Collaborator

brianaj commented Dec 8, 2025

@kine taking a look at getting this change in, but may have some confusion with the goal of this PR. Seeing as GEI doesn't support migrations to GHES, were you looking to make this command compatible with GitHub with Data Residency?

@kine
Copy link
Author

kine commented Dec 9, 2025

@brianaj Yes, it is to be able to use it for GitHub with Data Residency.

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

Code Coverage

Package Line Rate Branch Rate Complexity Health
ado2gh 72% 70% 718
Octoshift 83% 73% 1746
bbs2gh 83% 78% 663
gei 81% 72% 574
Summary 81% (7763 / 9630) 73% (1848 / 2531) 3701

@kine
Copy link
Author

kine commented Dec 9, 2025

Just to add detail - I am migrating from Azure DevOps to GHE.com (GitHub with Data Residency). Rest of the migration is already working, this is solving the add-team-to-repo action which was not extended to support this.

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