Skip to content

Use string comparison to check the result of variable expansion#806

Merged
devm33 merged 1 commit intogithub:mainfrom
Trenly:Truthy
Dec 18, 2025
Merged

Use string comparison to check the result of variable expansion#806
devm33 merged 1 commit intogithub:mainfrom
Trenly:Truthy

Conversation

@Trenly
Copy link
Copy Markdown
Contributor

@Trenly Trenly commented Dec 18, 2025

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

Copilot AI review requested due to automatic review settings December 18, 2025 04:47
Copy link
Copy Markdown
Member

@devm33 devm33 left a comment

Choose a reason for hiding this comment

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

Thanks!

@devm33 devm33 merged commit 8638f81 into github:main Dec 18, 2025
6 checks passed
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

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' }
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
$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' }

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants