Skip to content

azsdk_1.0.0-dev.20250821.4

Pre-release
Pre-release

Choose a tag to compare

@azure-sdk azure-sdk released this 22 Aug 17:51
0c81d0a
Adding MCP tools for the CODEOWNERS file. (#11647)

* testing service label

* Add TestTools.cs for service code owner validation workflow

* Updated shared options method to include TestTools

* .

* Commiting testtools

* Removed SharedOptions duplicate

* Changes

* Fixed the TestTools code and updated GitHubLabelsTool to use GithubServices when looking for common-labels

* Made changes to avoid repetition of code and processes.

* cleaned up CheckServiceLabel

* Changed the name of the tool to CommonValidationTool. Changed the overall code structure to use a simplified work flow. Added some caching to improve performance when validating code owners. Need to add implementation for checking groups of code owners and add better documentation to make the structure more intuitive.

* starting create service label tool

* starting method to insert into csv

* Bikeshedding.

* Updated path of Validate-AzsdkCodeOwner.ps1 to use the correct path.

* Started using threading to reduce runtime from 150 to 10 seconds.
⦁	Each repo runs in parallel
⦁	Validating each code owner found in each repo is run in parallel
Added and updated Command Names for Shirel's MCP tool and others.
Updated Codeowners Parser method call to use its capability to expand teams into individuals.
Started checking if the provided service label matches PRLabels.

* Changes .equals to .contains for more flexibility.

* updating common-labels.csv

* Added MCP tool to verify label exists within common-labels.csv

* Init

* CreateServiceLabel tool and modify structure of CLI commands

* corrected the descriptions of the MCP tools for labels

* added method for finding insertion line + fixed logic for csv handling

* CreateBranch method

* removed excess comments

* Extract business logic, add testing

* Fixes

* changed return type of CheckServiceLabel

* imported csvhelper dependency into CheckServiceLabel

* modified CreateBranchAsync method

* Added some tests that need to be changed and updated changes from validation branch.

* Deleted tests for methods that were deleted

* Deleted files

* Added additional workflow into CreateServiceLabel

* Added the insert content method for a specific branch and updated related GitHub interfaces.

* added csvhelper to helper file

* Updated the method to use the new LabelHelper method.

* Added the new sorting and insertion process.

* Updated the LabelHelper to use the CsvHelper to fix writing issues.

* Updated LabelHelper

* Changes

* updated CreateServiceLabel to verify label before creating a branch

* solved errors

* Updated comments in CreateServiceLabel tool

* Seperated the logic in the CommonValidationTool into CodeOwnerValidationHelper.
Wrote tests for both classes.
Added to ServiceRegistrations.

* Restructured CreateServiceLabel so logic flows better

* Updated all CodeOwner files. Migrated Powershell script that validates codeowners to C#.

* added a verification for branches and normalized label

* Changed naming and started adding functions for codeowner manipulation.

* Pulled updated GitHubService.cs from the labels branch

* Created outline/baseline for DeleteCodeOwners method, still needs to modify file

* Added add codeowner methods. Updated CodeownersParser to look within blocks

* .

* added tests for create service label and normalize label

* added tests for create service label and normalize label

* Added helper methods and filled in deleteCodeOwners

* Codeowner create methods

* Cleaning

* Updated CodeOwnerTools to use both the full and partial repo name.
Optimized CodeOwnerValidator to only check for required fields.

* Took out redundant lines

* mock implementation and changed way of  order in helper

* mock implementation and changed way of  order in helper

* Restructed CheckServiceLabel to include more information about color code checks

* Added MockTool in replacement of CodeOwnerTools. (Working on simplifications)
Codeowner tools now implements the capability to add a codeowners entry. This does rely on changes to the CodeownersEntry class. (still need confirmation on those changes for this to work)
Pulled in Label services.

* Added some changes to CodeownersEntry classes to
support the look up of the start and end line for an entry.

* updated labels tools and helpers

* Finished up methods for codeowner helper class.
Added in function to check if a service label is currently in a PR.
        Implemented that function in GitHubLabelsTool
Finished up codeowner entry methods.

* deleted the csv parser

* Added tests.
Updated implementation to update an existing pr.

* Changed Label to LabelData.

* Undid fix for octokit reference.

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli.Tests/Helpers/LabelHelperTests.cs

Co-authored-by: Daniel Jurek <djurek@microsoft.com>

* removed testLogger

* Update GitHubLabelsTool.cs

Deleted comments.

* Update GitHubService.cs

Took out unnecessary method. Updated updatefileasync to return string.

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Helpers/LabelHelper.cs

Co-authored-by: Daniel Jurek <djurek@microsoft.com>

* Update LabelHelper.cs

Updated naming

* Update GitHubLabelsTool.cs

Updated naming

* Modified the getlabelsfromcsv method

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Helpers/LabelHelper.cs

Co-authored-by: Daniel Jurek <djurek@microsoft.com>

* fixed errors

* Update MockGitHubService.cs

Deleted unused method

* Split the get portion of the branch function into it's own method for later use.

* Removed draft from PR creations in CreateServiceLabel

* Removed genericResponse from createServiceLabel return output.

* changed createbranch method to return enum

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/GitHubLabelsTool/GitHubLabelsTool.cs

Co-authored-by: Daniel Jurek <djurek@microsoft.com>

* Solved errors

* Comparing by service label first now.
Added merge method for split codeowner entries.
Added method to check if a service label is currently being reviewed in a PR.
Split CreateBranch into getbranch to provide easier access.
Removed GetContentsAsync override.
Codeowners:
	Split codeowners workflow into CheckServiceExists, then validate or create.
	AddCodeownersEntry:
		Now checks if there's an existing branch. Updates a PR instead of creates in this case.
		Checks for service label in review.
Added codeowner tests

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli.Tests/MockServices/MockGitHubService.cs

Co-authored-by: Daniel Jurek <djurek@microsoft.com>

* Changed some codeowners Tests

* Made changes from PR review.

* .

* Took out some features to prepare for PR.

* Added in edge case fixes for merging codeowner entries.

* Cleaning up more files for PR.

* Update MockGitHubService.cs

* Merged changes from explore2025-labels branch.
Also cleaned up more things for PR review.

* Removed information

* Created new service response for label tools

* Changed return type of CheckServiceLabel

* Cleaned up validation

* add codeowners tool

* Added new helper methods to reduce repetition.

* Updated addcodeowners to use helper method.

* Updated validation workflow.

* changed tool from add to update

* Merged changes.

* added delete functionality to modify codeowners

* validation check for modifycodeowners

* restructured modifycodeownersentrylines to reduce repetition

* Updated logic for codeowners and updated tests.

* Changes to undo

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/GitHubLabelsTool/GitHubLabelsTool.cs

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>

* declared constant for color of service labels

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/GitHubLabelsTool/GitHubLabelsTool.cs

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>

* Removed the CSV Helper dependency

* removed unused method for adding codeowners

* changed description of tools

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/GitHubLabelsTool/GitHubLabelsTool.cs

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>

* solved errors

* modified tests

* deleted the try and catch for the helper method

* updated the exception thrown in modifycodeownerentrylines to include both error messages

* .

* added the wrapper method

* added some tests

* added PR class

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli.Tests/Helpers/LabelHelperTests.cs

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>

* removed date and time from branch name creation

* added delete logic for updateCodeowners + fixed some errors in branch and file management

* modified getFileContentsAsync method

* modified tests names

* created helper method for branch, file, and pr management

* deleted response error

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/GitHubLabelsTool/GitHubLabelsTool.cs

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>

* reduced the amount of parameters taken in for createCodeownerPR

* Added in tests for sorting and some other simple updates.
One test currently fails, waiting for discussion on changes to that.

* fixed service label access in updateCodeowners

* fixed service label access in updatecodeowners

* Updated Create and Check service label.
Using .Split and getting rid of whitespace.

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Helpers/LabelHelper.cs

Co-authored-by: Praven Kuttappan <55455725+praveenkuttappan@users.noreply.github.com>

* .

* Removed dictionary in preparation for changed CODEOWNERS headers.
Reduced CodeownerTools complexity.
More changes needed to confirm workflows.
One test still failing due to pending discussion.

* changed labelhelper methods to static

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/GitHubLabelsTool/GitHubLabelsTool.cs

Co-authored-by: Praven Kuttappan <55455725+praveenkuttappan@users.noreply.github.com>

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/GitHubService.cs

Co-authored-by: Praven Kuttappan <55455725+praveenkuttappan@users.noreply.github.com>

* modified comment

* Updated tests to be more condensed.
Updated codeowner helper to get rid of special characters.

* consolidated codeowner validation logic

* Moved response to helper class.

* Added "Azure" "azure-sdk-tools" and "common-labels.csv" to Constants.

* Updated constants and csv parsing.

* Added constants.

* inline findCodeownerEntries method

* Removed AddCodeownerEntry and UpdateCodeowners and replaced it with UpdateCodeowners.
This new method does the work of both
Added in a bunch of tests, getting some failures so there are bugs that need to be fixed.

* Updated the codeowners validation to return the results so users can see which users need to do what.

* Updating tests.

* clarified comments + reduced redundancy

* indentation

* Fixing changes and merging labels pr.

* Fixing logic within the insertion tools and removing excessive tests.

* Updated tests.

* .

* Merging changes.

* .

* Updated naming.

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/GitHubService.cs

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

* added null conditional operator

* Moved methods to helper classes to be used in testing later.
Removed duplicate logic when finding a matching service entry.

* Getting rid of test causing pipeline to fail.
The test the FileHelpers class which produces errors.

* Fixing get contents method and adding SetFailure to Mcp tool catch blocks.

* Update tools/codeowners-utils/Azure.Sdk.Tools.CodeownersUtils/Parsing/CodeownersEntryPathComparer.cs

Co-authored-by: Daniel Jurek <djurek@microsoft.com>

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Commands/SharedOptions.cs

Co-authored-by: Daniel Jurek <djurek@microsoft.com>

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/CodeownersTools/CodeownersTools.cs

Co-authored-by: Daniel Jurek <djurek@microsoft.com>

* removed labelsha

* Added suggested changes. Fixed null errors.

* Updated expected output for one test and updated management plane check.

* Removed working branch as it complicates workflows.

* Fixed tests.

* Fixed a lot of logic errors.
Reverted back to using workingBranch. Unsure of what direction we're going.

* Update LabelHelperTests.cs

* Added in suggestions and changed ordering for CodeownersHelper.cs
Added in check in LabelHelper.cs to check for the tag "created by copilot"
Updated GitHubService.cs to have override parameter for GetContentsSingleAsync, and added helper methods for CodeownersValidatorHelper.cs
Simplified unnecessary tests
Moved and changed tests in CodeownersEntryPathComparerTests.cs
Added suggestions to CodeownersTools.cs and CodeownersValidatorHelper.cs

* Merged main

* Changes to uncommit

* Merging main

* Merging main

* Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/CodeownersTools/CodeownersTools.cs

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>

* added exit code

* Added in suggestions to CodeownersTools and CodeownersValidatorHelper.

* Merging.

* Simplify command handling in Program.cs

* Update GitHubService.cs

* Removed blocker from GitHubService.

* changed from switch to if statements

* Update CodeownersEntryPathComparerTests.cs

* Added regex comments.

* Added in Praveen's suggestions.

* Merge branch 'main' of https://github.com/Azure/azure-sdk-tools into explore2025-codeowners

* changed for use string builder

* Implemented suggestions.

* Adding suggestions

* Updated exit codes.

---------

Co-authored-by: Michelle <t-michellema@microsoft.com>
Co-authored-by: ReilleyMilne <t-remilne@microsoft.com>
Co-authored-by: shirelmr <t-smarino@microsoft.com>
Co-authored-by: Daniel Jurek <djurek@microsoft.com>
Co-authored-by: Michelle Ma <145605943+michiisai@users.noreply.github.com>
Co-authored-by: Shirel Marino <80732950+shirelmr@users.noreply.github.com>
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
Co-authored-by: Praven Kuttappan <55455725+praveenkuttappan@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>