-
Notifications
You must be signed in to change notification settings - Fork 320
Sync eng/common directory with azure-sdk-tools for PR 13005 #3371
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 #3371
Conversation
965f64d to
ed333df
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
This PR syncs the eng/common directory with changes from azure-sdk-tools PR #13005, adding support for tracking TypeSpec project paths (SpecProjectPath) in package properties and Azure DevOps work items.
- Adds
SpecProjectPathproperty toPackagePropsclass, read fromtsp-location.yamlfiles - Updates work item creation/update logic to include and sync the
Custom.SpecProjectPathfield - Adds logging output for the spec project path in package property display
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 | Adds SpecProjectPath property to PackageProps class and loads it from tsp-location.yaml if present |
| eng/common/scripts/Save-Package-Properties.ps1 | Adds logging output to display the spec project path when processing packages |
| eng/common/scripts/Validate-All-Packages.ps1 | Passes SpecProjectPath from package info to work item update function |
| eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1 | Adds Custom.SpecProjectPath field handling in work item queries, creation, and updates |
|
|
||
|
|
||
|
|
||
| if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and $packageInfo.SpecProjectPath) -or |
Copilot
AI
Nov 25, 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 condition (!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and $packageInfo.SpecProjectPath) may not work as intended in PowerShell. When $packageInfo.SpecProjectPath is an empty string (the default value from the parameter), PowerShell will treat it as falsy, but you likely want to update the work item only when there's a non-empty value.
Consider using a more explicit check:
if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and ![string]::IsNullOrEmpty($packageInfo.SpecProjectPath)) -or
($workItem.fields.ContainsKey('Custom.SpecProjectPath') -and ($workItem.fields['Custom.SpecProjectPath'] -ne $packageInfo.SpecProjectPath))This ensures that empty strings from the default parameter value don't trigger unnecessary updates.
| if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and $packageInfo.SpecProjectPath) -or | |
| if ((!$workItem.fields.ContainsKey('Custom.SpecProjectPath') -and -not [string]::IsNullOrEmpty($packageInfo.SpecProjectPath)) -or |
| } | ||
|
|
||
| if (Test-Path (Join-Path $directoryPath 'tsp-location.yaml')) { | ||
| $this.SpecProjectPath = (LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')).directory |
Copilot
AI
Nov 25, 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 assumes that LoadFrom-Yaml will return an object with a .directory property, but doesn't handle the case where the YAML file exists but doesn't contain a directory field, or when LoadFrom-Yaml returns $null (which can happen on parse errors).
Consider adding a null check:
if (Test-Path (Join-Path $directoryPath 'tsp-location.yaml')) {
$yamlContent = LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')
if ($yamlContent -and $yamlContent.directory) {
$this.SpecProjectPath = $yamlContent.directory
}
}This prevents potential null reference exceptions when accessing the .directory property.
| $this.SpecProjectPath = (LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml')).directory | |
| $yamlContent = LoadFrom-Yaml (Join-Path $directoryPath 'tsp-location.yaml') | |
| if ($yamlContent -and $yamlContent.directory) { | |
| $this.SpecProjectPath = $yamlContent.directory | |
| } |
Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#13005 See eng/common workflow