Use string comparison to check the result of variable expansion#806
Use string comparison to check the result of variable expansion#806devm33 merged 1 commit intogithub:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a boolean comparison issue in the WinGet workflow where GitHub Actions expands variables as strings rather than PowerShell booleans. The change updates the conditional logic to use proper string comparison to ensure releases are submitted to the correct WinGet package identifier.
Key Changes:
- Modified the package ID selection logic to use string comparison (
'true'/'false') instead of treating the expanded variable as a PowerShell boolean
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| run: | | ||
| # Set the package ID based on the release info | ||
| $packageId = if (${{ !github.event.release.prerelease }}) { "GitHub.Copilot" } else { "GitHub.Copilot.Prerelease" } | ||
| $packageId = if ('${{ !github.event.release.prerelease }}' -eq 'true') { 'GitHub.Copilot' } else { 'GitHub.Copilot.Prerelease' } |
There was a problem hiding this comment.
The double negation in this condition makes the logic harder to follow. Since github.event.release.prerelease already indicates whether it's a prerelease, the negation operator ! adds unnecessary complexity. Consider checking if the value equals 'false' directly instead of checking if the negated value equals 'true'. This would make the condition more straightforward and easier to understand.
| $packageId = if ('${{ !github.event.release.prerelease }}' -eq 'true') { 'GitHub.Copilot' } else { 'GitHub.Copilot.Prerelease' } | |
| $packageId = if ('${{ github.event.release.prerelease }}' -eq 'false') { 'GitHub.Copilot' } else { 'GitHub.Copilot.Prerelease' } |
This PR updates the conditional to properly check the prerelease property. Because GitHub Actions expands the variable as a string (
true) and not the boolean that PowerShell expects ($true), a simple string comparison should ensure the releases go into the correct WinGet Identifier