-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Sync eng/common directory with azure-sdk-tools for PR 13005 #44146
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?
Sync eng/common directory with azure-sdk-tools for PR 13005 #44146
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 PR synchronizes the eng/common directory with azure-sdk-tools for PR #13005. The primary purpose is to add support for tracking the spec project path (from TypeSpec location files) in Azure DevOps work items used for release tracking. This enables better linkage between SDK packages and their corresponding API specification projects.
Key changes:
- Added
SpecProjectPathproperty to thePackagePropsclass that reads fromtsp-location.yamlfiles - Updated work item creation/update logic to include the spec project path in Azure DevOps tracking
- Removed a redundant title comparison check in the work item update logic
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| eng/common/scripts/Package-Properties.ps1 | Added SpecProjectPath property to PackageProps class and logic to read it from tsp-location.yaml |
| eng/common/scripts/Save-Package-Properties.ps1 | Added logging output to display the spec project path |
| eng/common/scripts/Validate-All-Packages.ps1 | Updated function call to pass SpecProjectPath parameter |
| eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 | Added spec project path handling throughout work item operations, including querying, creation, and updating |
| } | ||
|
|
||
| if (Test-Path (Join-Path $directoryPath 'tsp-location.yaml')) { | ||
| $this.SpecProjectPath = (LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')).directory |
Copilot
AI
Nov 22, 2025
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.
The code accesses .directory property on the result of LoadFrom-Yaml without checking if the result is null. If the YAML file exists but is malformed or empty, LoadFrom-Yaml returns null (as seen in the function definition), which will cause a null reference error when accessing .directory. Add a null check before accessing the property.
| $this.SpecProjectPath = (LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')).directory | |
| $tspLocation = LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml') | |
| if ($tspLocation -ne $null) { | |
| $this.SpecProjectPath = $tspLocation.directory | |
| } | |
| else { | |
| $this.SpecProjectPath = $null | |
| } |
| if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and $packageInfo.SpecProjectPath) -or | ||
| ($workItem.fields.ContainsKey('Custom.SpecProjectPath') -and ($workItem.fields['Custom.SpecProjectPath'] -ne $packageInfo.SpecProjectPath)) | ||
| ) { |
Copilot
AI
Nov 22, 2025
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.
[nitpick] The condition can be simplified for better readability. The current logic checks if the field is missing and there's a value, or if the field exists and has a different value. This can be more concisely expressed as: update if $packageInfo.SpecProjectPath is present and either the field doesn't exist or has a different value. Consider: if ($packageInfo.SpecProjectPath -and ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath')) -or ($workItem.fields['Custom.SpecProjectPath'] -ne $packageInfo.SpecProjectPath)))
| if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and $packageInfo.SpecProjectPath) -or | |
| ($workItem.fields.ContainsKey('Custom.SpecProjectPath') -and ($workItem.fields['Custom.SpecProjectPath'] -ne $packageInfo.SpecProjectPath)) | |
| ) { | |
| if ($packageInfo.SpecProjectPath -and ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath')) -or ($workItem.fields['Custom.SpecProjectPath'] -ne $packageInfo.SpecProjectPath))) { |
Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#13005 See eng/common workflow