Skip to content

Conversation

@Trenly
Copy link
Contributor

@Trenly Trenly commented Dec 4, 2025

📖 Description

PR adds a GitHub action workflow for submitting the release to winget-pkgs repository.

GitHub Repository Secret

To add a personal access token (PAT), one can follow the steps listed in https://github.com/microsoft/winget-create?tab=readme-ov-file#github-personal-access-token-classic-permissions. Before this PR is merged, maintainers will need to create a repository secret with the name WINGET_CREATE_GITHUB_TOKEN.

🔗 References and Related Issues

See similar actions in the following repositories

🔍 How to Test

Action is tricky to test without a fork, but I've tested similar actions in private forks previously. One can test the wingetcreate command by omitting the --submit flag to see if the command will succeed

As a side note - if the workflow starts randomly failing, it is likely that whichever fork of winget-pkgs the repository secret is giving access to is outdated and needs to be synced with the upstream due to a bug in Octokit

✅ Checklist

Copy link
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.

Thank you!

@devm33 devm33 marked this pull request as ready for review December 5, 2025 02:07
Copilot AI review requested due to automatic review settings December 5, 2025 02:07
Copilot finished reviewing on behalf of devm33 December 5, 2025 02:08
Copy link
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 adds a GitHub Actions workflow to automatically submit new releases to the WinGet community repository using the wingetcreate tool. The workflow triggers on release publication and uses a repository secret for authentication.

Key Changes:

  • Adds automated WinGet package submission workflow triggered on release publication
  • Implements logic to differentiate between stable and prerelease packages
  • Downloads and executes wingetcreate to update package manifests with x64 and arm64 installers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


# winget-create is only supported on Windows
runs-on: windows-latest

Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

[nitpick] Trailing whitespace present on this line.

Suggested change

Copilot uses AI. Check for mistakes.
- name: Submit package using wingetcreate
run: |
# Set the package ID based on the release info
$packageId = if (${{ !github.event.release.prerelease }}) { "GitHub.Copilot" } else { "GitHub.Copilot.Prerelease" }
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The PowerShell conditional expression is incorrect. Using ${{ !github.event.release.prerelease }} inside a PowerShell script will evaluate to a literal string "True" or "False" rather than a PowerShell boolean. This will cause the conditional to always evaluate to true (as non-empty strings are truthy).

Replace with:

$packageId = if ('${{ github.event.release.prerelease }}' -eq 'false') { "GitHub.Copilot" } else { "GitHub.Copilot.Prerelease" }
Suggested change
$packageId = if (${{ !github.event.release.prerelease }}) { "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.
# Get installer info from release event
$assets = '${{ toJSON(github.event.release.assets) }}' | ConvertFrom-Json
$packageVersion = (${{ toJSON(github.event.release.tag_name) }})
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The toJSON function is unnecessary here and will add extra quotes around the tag name. The tag_name is already a string, so wrapping it with toJSON() and then assigning it to a PowerShell variable will result in a doubly-quoted string like "v1.0.0" instead of v1.0.0.

Replace with:

$packageVersion = '${{ github.event.release.tag_name }}'
Suggested change
$packageVersion = (${{ toJSON(github.event.release.tag_name) }})
$packageVersion = '${{ github.event.release.tag_name }}'

Copilot uses AI. Check for mistakes.
# This allows overrides to be used so that wingetcreate does not have to guess the architecture from the filename
$installerUrlx64 = $assets | Where-Object -Property name -like '*win32-x64.zip' | Select-Object -ExpandProperty browser_download_url
$installerUrlarm64 = $assets | Where-Object -Property name -like '*win32-arm64.zip' | Select-Object -ExpandProperty browser_download_url
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

Missing error handling if the installer URLs are not found. If the asset patterns don't match or the assets are missing, $installerUrlx64 or $installerUrlarm64 will be empty, causing the wingetcreate command to fail with unclear errors.

Consider adding validation:

if ([string]::IsNullOrEmpty($installerUrlx64) -or [string]::IsNullOrEmpty($installerUrlarm64)) {
  Write-Error "Failed to find required installer assets"
  exit 1
}
Suggested change
# Validate installer URLs
if ([string]::IsNullOrEmpty($installerUrlx64) -or [string]::IsNullOrEmpty($installerUrlarm64)) {
Write-Error "Failed to find required installer assets"
exit 1
}

Copilot uses AI. Check for mistakes.
@devm33 devm33 merged commit 6fba102 into github:main Dec 5, 2025
6 checks passed
@Trenly
Copy link
Contributor Author

Trenly commented Dec 5, 2025

The workflow will fail until the prs in winget-pkgs are merged, which is why this was marked as draft

@devm33
Copy link
Member

devm33 commented Dec 5, 2025

The workflow will fail until the prs in winget-pkgs are merged, which is why this was marked as draft

Ah oops 😅 Looks like the PRs should make it in time before the next release thankfully 🤞

@Trenly
Copy link
Contributor Author

Trenly commented Dec 5, 2025

The workflow will fail until the prs in winget-pkgs are merged, which is why this was marked as draft

Ah oops 😅 Looks like the PRs should make it in time before the next release thankfully 🤞

Yep! Looks like we should be good

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.

Publish releases to WinGet

3 participants