Skip to content

S⚠️ ◾ Automated Package Update#822

Closed
neilr81 wants to merge 41 commits into
mainfrom
automation/package-update-21805918907
Closed

S⚠️ ◾ Automated Package Update#822
neilr81 wants to merge 41 commits into
mainfrom
automation/package-update-21805918907

Conversation

@neilr81
Copy link
Copy Markdown
Contributor

@neilr81 neilr81 commented Feb 8, 2026

This PR was created automatically by the workflow run 21805918907.

neilr81 and others added 30 commits February 7, 2026 14:08
This script updates NuGet package versions in the Directory.Packages.props file by querying the latest available versions and updating the Version attributes accordingly, while respecting the PreserveMajor attribute and pre-release version detection.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Changed the trigger for package updates to a scheduled cron job.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Initial plan

* Gate PR creation on changes detection flag

Co-authored-by: neilr81 <49037171+neilr81@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: neilr81 <49037171+neilr81@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Removed GitHub CLI installation step from workflow.
Removed the 'powershell' label from the automated package update PR.
@neilr81 neilr81 requested a review from a team as a code owner February 8, 2026 21:45
@neilr81 neilr81 added the automation Item has been created automatically. label Feb 8, 2026
Copilot AI review requested due to automatic review settings February 8, 2026 21:45
@neilr81 neilr81 self-assigned this Feb 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 8, 2026

PR Metrics

Thanks for keeping your pull request small.
⚠️ Consider adding additional tests.

Lines
Product Code 350
Test Code -
Subtotal 350
Ignored Code 68
Total 418

Metrics computed by PR Metrics. Add it to your Azure DevOps and GitHub PRs!

@github-actions github-actions Bot changed the title Automated Package Update S⚠️ ◾ Automated Package Update Feb 8, 2026
@neilr81 neilr81 closed this Feb 8, 2026
@neilr81 neilr81 deleted the automation/package-update-21805918907 branch February 8, 2026 21:47
Copy link
Copy Markdown
Contributor

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

Adds GitHub Actions automation to keep centrally-managed NuGet package versions up to date, plus updates MSTest package versions as part of the automated run.

Changes:

  • Updates MSTest package versions in Directory.Packages.props.
  • Adds a scheduled GitHub Actions workflow to run an update script and open a PR.
  • Introduces a PowerShell script to query latest package versions and update Directory.Packages.props for AutoUpdate groups.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
Directory.Packages.props Updates MSTest versions (and includes formatting/encoding churn from automated save).
.github/workflows/package-update.yml Adds scheduled automation to run the updater script and open a PR.
.github/scripts/Update-NuGetPackageVersions.ps1 Implements the package-version update logic using dotnet package search and XML editing.

Comment on lines +167 to +171
$searchCmd = "dotnet package search `"$PackageId`" --exact-match --format json $prereleaseFlag $configSourceFlag"

if ($EnableVerboseLogging) {
Write-Host " [VERBOSE] Executing: $searchCmd"
}
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid Invoke-Expression for running dotnet; it makes command construction brittle and can enable injection if the package id ever contains unexpected characters. Prefer invoking dotnet directly with an argument array (e.g., & dotnet package search ...) and capture stdout/stderr explicitly.

Copilot uses AI. Check for mistakes.
Comment on lines +121 to +125
if ($firstVersionObject.Version -eq $secondVersionObject.Version) {
if (-not $firstVersionObject.Suffix) { return $First }
if (-not $secondVersionObject.Suffix) { return $Second }
if ($firstVersionObject.Suffix -lt $secondVersionObject.Suffix) { return $Second }
return $First
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-release comparison uses lexicographic string ordering for the suffix (e.g., -rc.2 may compare greater than -rc.10), which can select the wrong “latest” version when base versions match. Consider parsing NuGet versions with System.Management.Automation.SemanticVersion (PowerShell 7) or NuGet.Versioning to compare prerelease identifiers numerically/semver-correctly.

Copilot uses AI. Check for mistakes.
Comment on lines +340 to +343
if ($updateCount -gt 0) {
Write-Host "##[section]Saving $updateCount package updates to $propsFile"
$xml.Save($propsFile)
Write-Host "Successfully updated $updateCount packages"
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saving via XmlDocument.Save() appears to normalize formatting/encoding (e.g., BOM + self-closing tag spacing), producing large diffs unrelated to version changes. Consider updating only the Version attribute text in-place or saving with preserved encoding/formatting to minimize churn in automated PRs.

Copilot uses AI. Check for mistakes.
Comment on lines +173 to +176
Write-Host ("Searching for package: {0} {1}" -f $PackageId, ($MajorVersion ? ('(major version {0}.*)' -f $MajorVersion) : ''))

$output = Invoke-Expression $searchCmd 2>&1 | Out-String

Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet package search --format json is parsed with ConvertFrom-Json, but the command output is captured with 2>&1, which can mix non-JSON stderr (warnings/progress) into stdout and break JSON parsing even when the command succeeds. Consider capturing stdout only for JSON parsing and handling stderr separately.

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +7
on:
schedule:
- cron: "0 6 * * 1"
pull_request:
branches: [ "main" ]
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow is configured to run on every pull_request targeting main, which can cause unnecessary runs (and potentially extra automated PRs) whenever any PR is opened/updated. Consider removing the pull_request trigger and using workflow_dispatch (manual) alongside schedule so updates are only generated intentionally.

Copilot uses AI. Check for mistakes.
Comment on lines +147 to +151
# Prefer NuGet-GitHub.Config (used on GitHub runners) when present, otherwise fall back to NuGet.config
$nugetGithubConfigPath = Join-Path $SourcesDirectory "NuGet-GitHub.Config"
$nugetConfigPath = Join-Path $SourcesDirectory "NuGet.config"
$configSourceFlag = ""
if (Test-Path $nugetGithubConfigPath) {
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script falls back to NuGet.config, but the repo config file is NuGet.Config (case-sensitive on non-Windows). Use the correct filename (or probe both casings) so local/Linux runs and container builds reliably pick up the intended feeds.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation Item has been created automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants