Skip to content

Fix Get-LatestPackageVersion ignoring prerelease flag and configfile in dotnet args#833

Merged
neilr81 merged 2 commits intobugfix/add-pufrom
copilot/sub-pr-794
Mar 2, 2026
Merged

Fix Get-LatestPackageVersion ignoring prerelease flag and configfile in dotnet args#833
neilr81 merged 2 commits intobugfix/add-pufrom
copilot/sub-pr-794

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

Get-LatestPackageVersion in Update-DotNetSdkVersions.ps1 computed $prereleaseFlag and $configSourceFlag but never used them — $dotnetArgs always included --prerelease unconditionally, omitted --exact-match, and never passed --configfile. This could silently update MSBuild SDKs to prerelease versions and search the wrong feeds.

Changes

  • Removed unused $prereleaseFlag, $configSourceFlag, and $searchCmd variables
  • Replaced $configSourceFlag (embedded CLI string) with $configFilePath (plain path)
  • Rebuilt $dotnetArgs from the actual computed values:
$dotnetArgs = @('package', 'search', $PackageId, '--exact-match', '--format', 'json')

if ($IncludePrerelease) { $dotnetArgs += '--prerelease' }

if ($configFilePath) {
    $dotnetArgs += '--configfile'
    $dotnetArgs += $configFilePath
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…le args

Co-authored-by: neilr81 <49037171+neilr81@users.noreply.github.com>
Copilot AI changed the title [WIP] Update GitHub Actions workflow for package updates Fix Get-LatestPackageVersion ignoring prerelease flag and configfile in dotnet args Mar 2, 2026
@neilr81 neilr81 marked this pull request as ready for review March 2, 2026 17:52
@neilr81 neilr81 requested a review from a team as a code owner March 2, 2026 17:52
@neilr81 neilr81 merged commit ff3f85b into bugfix/add-pu Mar 2, 2026
1 check passed
@neilr81 neilr81 deleted the copilot/sub-pr-794 branch March 2, 2026 17:52
neilr81 added a commit that referenced this pull request Mar 4, 2026
* Add GitHub Actions workflow for package updates

* Add script to update NuGet package versions

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.

* Update script paths in package-update.yml

* Apply suggestion from @Copilot

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

* Update package-update workflow to use cron schedule

Changed the trigger for package updates to a scheduled cron job.

* Update .github/scripts/Update-NuGetPackageVersions.ps1

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

* Gate PR creation on commit detection in package-update workflow (#796)

* 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>

* Update .github/scripts/Update-NuGetPackageVersions.ps1

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

* Apply suggestion from @Copilot

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

* Apply suggestion from @Copilot

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

* Apply suggestion from @Copilot

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

* Add pull_request_target trigger to workflow

* Apply suggestion from @Copilot

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

* Update package-update.yml

* Update package-update.yml

* Rename checkout step for clarity

* Remove GitHub CLI installation from package-update.yml

Removed GitHub CLI installation step from workflow.

* Update Update-NuGetPackageVersions.ps1

* Fix label assignment in package-update workflow

* Remove 'powershell' label from package update PR

Removed the 'powershell' label from the automated package update PR.

* Add label to automated package update PR

* Fix label formatting in package-update.yml

* Add token input for create pull request action

* Update GH_TOKEN to use secrets for PR creation

* Update package-update.yml

* Add script to update .NET SDK and MSBuild SDK versions

This script updates .NET SDK and MSBuild SDK versions in the global.json file by querying the latest releases and modifying the file accordingly.

* Add step to update .NET SDK versions in workflow

* Change fetch-depth from 0 to 1 in workflow

* Update package-update.yml to remove pull_request trigger

Remove pull_request trigger from package-update workflow

* Prevent branch name collisions in package-update workflow (#825)

* Initial plan

* Add run_attempt to branch name and concurrency group to prevent collisions

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

* Enable cancellation of in-progress package updates

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: neilr81 <49037171+neilr81@users.noreply.github.com>

* Fix SourcesDirectory parameter fallback for GitHub Actions in Update-DotNetSdkVersions.ps1 (#826)

* Initial plan

* Add fallback logic for SourcesDirectory in Update-DotNetSdkVersions.ps1

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>

* Update .github/workflows/package-update.yml

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

* Update .github/scripts/Update-DotNetSdkVersions.ps1

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

* Apply suggestion from @Copilot

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

* Update package-update.yml

* Apply suggestions from code review

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

* Update Update-NuGetPackageVersions.ps1

* Apply suggestions from code review

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

* Rename workflow steps for clarity

* Update .github/scripts/Update-NuGetPackageVersions.ps1

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

* Fix prerelease suffix ordering in Update-DotNetSdkVersions.ps1 (#831)

* Initial plan

* fix: replace simple string suffix comparison with token-by-token Compare-PreReleaseSuffix in Update-DotNetSdkVersions.ps1

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>

* Replace Azure Pipelines logging commands with GitHub Actions-native annotations in NuGet update script (#830)

* Initial plan

* Replace ##[section] Azure Pipelines logging with GitHub Actions ::notice:: annotations

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>

* Apply suggestion from @Copilot

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

* Update .github/scripts/Update-NuGetPackageVersions.ps1

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

* Update .github/scripts/Update-DotNetSdkVersions.ps1

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

* Update .github/scripts/Update-NuGetPackageVersions.ps1

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

* Update .github/scripts/Update-DotNetSdkVersions.ps1

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

* Fix Get-LatestPackageVersion ignoring prerelease flag and configfile in dotnet args (#833)

* Initial plan

* Fix Get-LatestPackageVersion to correctly use prerelease and configfile args

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>

* Add NuGetConfigPath option and update workflow

Introduce an optional NugetConfigPath parameter to Update-NuGetPackageVersions.ps1 and Update-DotNetSdkVersions.ps1 so the scripts can use a configurable NuGet config file (default: NuGet.Config). Update verbose messages and warnings to reference the chosen config path and simplify config selection logic to prefer the provided config name. Update the package-update GitHub Actions workflow to pass NuGet-GitHub.Config to both scripts and switch actions/setup-dotnet to use the repository global.json (global-json-file) instead of a hardcoded dotnet-version.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Neil Richardson <neil.richardson@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants