Skip to content

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

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

Fix SourcesDirectory parameter fallback for GitHub Actions in Update-DotNetSdkVersions.ps1#826
neilr81 merged 2 commits intobugfix/add-pufrom
copilot/sub-pr-794

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

The Update-DotNetSdkVersions.ps1 script defaulted $SourcesDirectory to $env:BUILD_SOURCESDIRECTORY, which is unset in GitHub Actions, causing Join-Path to throw when the script is invoked without explicit parameters.

Changes

  • Parameter default: Added conditional fallback checking $env:BUILD_SOURCESDIRECTORY$env:GITHUB_WORKSPACE(Get-Location).Path
  • Validation: Added null/whitespace checks, directory existence validation, and path normalization with Resolve-Path
  • Documentation: Updated parameter help to reflect multi-environment support

This matches the pattern already used in Update-NuGetPackageVersions.ps1:

[Parameter(Mandatory = $false)]
[string]$SourcesDirectory = $(
    if ($env:BUILD_SOURCESDIRECTORY) {
        $env:BUILD_SOURCESDIRECTORY
    }
    elseif ($env:GITHUB_WORKSPACE) {
        $env:GITHUB_WORKSPACE
    }
    else {
        (Get-Location).Path
    }
),

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

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

Copilot AI commented Feb 10, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: `/usr/bin/pwsh pwsh -Command

Simulate GitHub Actions environment

Remove-Item env:BUILD_SOURCESDIRECTORY -ErrorAction SilentlyContinue
$env:GITHUB_WORKSPACE = '/home/REDACTED/work/Omex/Omex'

Run the script - it will try to update, so we'll timeout after init

Write-Host 'Testing sc` (dns block)

  • Triggering command: `/usr/bin/pwsh pwsh -Command

Simulate local environment - no CI/CD variables

Remove-Item env:BUILD_SOURCESDIRECTORY -ErrorAction SilentlyContinue
Remove-Item env:GITHUB_WORKSPACE -ErrorAction SilentlyContinue

Write-Host 'Testing script in local environment (no CI variables)...'
.` (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update GitHub Actions workflow for package updates Fix SourcesDirectory parameter fallback for GitHub Actions in Update-DotNetSdkVersions.ps1 Feb 10, 2026
@neilr81 neilr81 marked this pull request as ready for review February 10, 2026 17:05
Copilot AI requested a review from neilr81 February 10, 2026 17:05
@neilr81 neilr81 requested a review from a team as a code owner February 10, 2026 17:05
@neilr81 neilr81 merged commit 9e4704c into bugfix/add-pu Feb 10, 2026
1 check passed
@neilr81 neilr81 deleted the copilot/sub-pr-794 branch February 10, 2026 17:05
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