-
Notifications
You must be signed in to change notification settings - Fork 123
1180 fix url validation #1464
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.
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
base: main
Are you sure you want to change the base?
1180 fix url validation #1464
Conversation
There was a problem hiding this 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 pull request adds URL validation to various CLI command arguments to prevent users from accidentally providing full URLs instead of just organization, repository, or enterprise names. The validation catches common URL patterns (http://, https://, www., domain/path) and provides clear, user-friendly error messages guiding users toward the correct format.
Key changes:
- Implements
IsUrl()extension method to detect URL patterns in strings - Adds URL validation to command argument classes across GEI, ADO2GH, and shared commands
- Includes comprehensive unit tests for the validation logic
- Provides a functional test script to verify validation across all commands
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Octoshift/Extensions/StringExtensions.cs | Adds IsUrl() method to detect URLs by checking for http://, https://, www., :// patterns, and domain/path combinations |
| src/gei/Commands/MigrateRepo/MigrateRepoCommandArgs.cs | Adds URL validation for github-source-org, github-target-org, source-repo, and target-repo options |
| src/gei/Commands/MigrateOrg/MigrateOrgCommandArgs.cs | Adds URL validation for github-source-org, github-target-org, and github-target-enterprise options |
| src/gei/Commands/GenerateScript/GenerateScriptCommandArgs.cs | Adds URL validation for github-source-org and github-target-org options |
| src/gei/Commands/MigrateSecretAlerts/MigrateSecretAlertsCommandArgs.cs | Adds URL validation for source-org, target-org, source-repo, and target-repo options |
| src/gei/Commands/MigrateCodeScanningAlerts/MigrateCodeScanningAlertsCommandArgs.cs | Adds URL validation for source-org, target-org, source-repo, and target-repo options |
| src/ado2gh/Commands/MigrateRepo/MigrateRepoCommandArgs.cs | Adds URL validation for github-org and github-repo options with new Validate method override |
| src/ado2gh/Commands/IntegrateBoards/IntegrateBoardsCommandArgs.cs | Adds URL validation for github-org and github-repo options with new Validate method override |
| src/Octoshift/Commands/DownloadLogs/DownloadLogsCommandArgs.cs | Adds URL validation for github-org and github-repo options (but error messages don't match GEI CLI option names) |
| src/Octoshift/Commands/CreateTeam/CreateTeamCommandArgs.cs | Adds URL validation for github-org option with new Validate method override |
| src/Octoshift/Commands/GrantMigratorRole/GrantMigratorRoleCommandArgs.cs | Adds URL validation for github-org option |
| src/Octoshift/Commands/RevokeMigratorRole/RevokeMigratorRoleCommandArgs.cs | Adds URL validation for github-org option |
| src/Octoshift/Commands/GenerateMannequinCsv/GenerateMannequinCsvCommandArgs.cs | Adds URL validation for github-org option with new Validate method override |
| src/Octoshift/Commands/ReclaimMannequin/ReclaimMannequinCommandArgs.cs | Adds URL validation for github-org option |
| src/OctoshiftCLI.Tests/StringExtensionsTests.cs | Adds comprehensive test cases for IsUrl() method covering various URL patterns and valid names |
| src/OctoshiftCLI.Tests/gei/Commands/MigrateRepo/MigrateRepoCommandArgsTests.cs | Adds tests for URL validation on all org/repo parameters |
| src/OctoshiftCLI.Tests/gei/Commands/MigrateOrg/MigrateOrgCommandArgsTests.cs | Adds tests for URL validation on org and enterprise parameters |
| src/OctoshiftCLI.Tests/gei/Commands/GenerateScript/GenerateScriptCommandArgsTests.cs | Adds tests for URL validation on org parameters |
| src/OctoshiftCLI.Tests/gei/Commands/MigrateSecretAlerts/MigrateSecretAlertsCommandArgsTests.cs | Adds tests for URL validation on all org/repo parameters |
| src/OctoshiftCLI.Tests/gei/Commands/MigrateCodeScanningAlerts/MigrateCodeScanningAlertsCommandArgsTests.cs | Adds tests for URL validation on all org/repo parameters |
| src/OctoshiftCLI.Tests/ado2gh/Commands/MigrateRepo/MigrateRepoCommandArgsTests.cs | Creates new test file with URL validation tests and valid names test |
| src/OctoshiftCLI.Tests/ado2gh/Commands/IntegrateBoards/IntegrateBoardsCommandArgsTests.cs | Creates new test file with URL validation tests and valid names test |
| src/OctoshiftCLI.Tests/Octoshift/Commands/DownloadLogs/DownloadLogsCommandArgsTests.cs | Creates new test file with URL validation tests and valid names test |
| src/OctoshiftCLI.Tests/Octoshift/Commands/CreateTeam/CreateTeamCommandArgsTests.cs | Creates new test file with URL validation tests and valid names test |
| src/OctoshiftCLI.Tests/Octoshift/Commands/GrantMigratorRole/GrantMigratorRoleCommandArgsTests.cs | Adds URL validation test |
| src/OctoshiftCLI.Tests/Octoshift/Commands/RevokeMigratorRole/RevokeMigratorRoleCommandArgsTests.cs | Adds URL validation test |
| src/OctoshiftCLI.Tests/Octoshift/Commands/GenerateMannequinCsv/GenerateMannequinCsvCommandArgsTests.cs | Creates new test file with URL validation tests and valid names test |
| src/OctoshiftCLI.Tests/Octoshift/Commands/ReclaimMannequin/ReclaimMannequinCommandArgsTests.cs | Adds URL validation test |
| test-url-validation.sh | New functional test script with 28 test cases covering all commands and edge cases (but has issues with tests 20-21) |
| RELEASENOTES.md | Documents the new URL validation feature for end users |
src/OctoshiftCLI.Tests/gei/Commands/MigrateRepo/MigrateRepoCommandArgsTests.cs
Outdated
Show resolved
Hide resolved
src/OctoshiftCLI.Tests/gei/Commands/MigrateOrg/MigrateOrgCommandArgsTests.cs
Outdated
Show resolved
Hide resolved
Unit Test Results 1 files 1 suites 10m 25s ⏱️ Results for commit 56a43b0. ♻️ This comment has been updated with latest results. |
3f32e7c to
feb168b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.
src/Octoshift/Commands/ReclaimMannequin/ReclaimMannequinCommandArgs.cs
Outdated
Show resolved
Hide resolved
src/Octoshift/Commands/GenerateMannequinCsv/GenerateMannequinCsvCommandArgs.cs
Outdated
Show resolved
Hide resolved
…tory, and enterprise name arguments and remove trailing blank lines from test files
feb168b to
75dcb0e
Compare
|
Hi @brianaj , Could you please review my PR and provide any suggestions? The functional test screenshot is attached below, and the release notes have been added
|
|
@AakashSuresh2003 I'll see if I can get to this this week. Have some older PRs I need to take a look at first. |
Added validation for URL arguments and improved error messages for path options.





…#1180)
ThirdPartyNotices.txt(if applicable)