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 Copilot AI review requested due to automatic review settings July 28, 2025 13:21
Copy link
Contributor

@Copilot 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

kine and others added 4 commits July 28, 2025 15:23
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…RepoCommandTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…RepoCommandHandlerTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

github-actions bot commented Jul 28, 2025

Unit Test Results

  1 files    1 suites   21s ⏱️
899 tests 899 ✅ 0 💤 0 ❌
900 runs  900 ✅ 0 💤 0 ❌

Results for commit 21f0264.

♻️ This comment has been updated with latest results.

Copy link

Code Coverage

Package Line Rate Branch Rate Complexity Health
gei 80% 72% 566
bbs2gh 83% 77% 648
ado2gh 83% 77% 619
Octoshift 87% 76% 1473
Summary 85% (7258 / 8565) 76% (1704 / 2246) 3306

@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?

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.

1 participant