Repository navigation
Check the winget manifest before it is submitted - #81
Open
chiragjangiir wants to merge 2 commits into
Open
chiragjangiir wants to merge 2 commits into
chiragjangiir wants to merge 2 commits into
Conversation
winget-releaser is handed WINGET_TOKEN, a PAT that can open PRs on a fork of winget-pkgs, and @v2 is a moving tag: it currently resolves to a commit pushed 2026-10-07 while the v2 release dates from 2025-01-27. Pinning to the commit @v2 resolves to today keeps the published behaviour identical while stopping a later tag move from running unreviewed code with that token. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
The first submission to winget-pkgs is still outstanding (JeremySNR#47), and the three YAML files it needs are produced by print-winget-manifest.mjs. Nothing checked them, so a manifest winget-pkgs would reject only surfaced during review. The generator now parses its own output and checks it against the winget 1.6.0 manifest schemas: required fields, identifier and version agreement across the trio, the installer URL naming the versioned asset the release uploads, hash format, the architecture and installer type enums, and the locale length limits. It also checks the one invariant only this repo knows: Scope has to match electron-builder's NSIS config in package.json, because that is what decides where winget installs the app. Nothing is written when a check fails. The emitted manifest is unchanged byte for byte for the current release, so this only adds the checks. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Two things on the winget path, refs #47.
vedantmgoyal9/winget-releaseris pinned to a commit instead of the moving@v2tag, and
scripts/print-winget-manifest.mjsnow checks the three YAML files itgenerates against the winget 1.6.0 manifest schemas — and against
package.json's NSIS scope — before it writes anything.Why?
#47 lists three remaining steps. Two of them live in this repo, and both were
still open.
The pin. The issue comment asks for this: the action is handed
WINGET_TOKEN, a PAT that can open PRs on a fork ofwinget-pkgs, and@v2isa mutable tag. That is not hypothetical — as of today
@v2resolves to a commitpushed 2026-10-07, while the
v2release dates from 2025-01-27, so thetag has already moved without a release:
The pin uses the commit
@v2resolves to today, so the published behaviour isidentical; a later tag move now needs a deliberate bump, and
docs/winget.mddocuments the one-liner for that.
The checks. The first submission to
microsoft/winget-pkgsis stilloutstanding, and this generator is what feeds it. Nothing verified its output,
so a manifest winget-pkgs would reject only surfaced during review —
winget validateandwingetcreatedo not run on macOS or Linux. Thegenerator now refuses to write a trio that fails, and prints why:
for architecture, installer type, scope and upgrade behaviour;
fields matching
DefaultLocale;and the hash being 64 hex characters;
Scopematchingpackage.json's NSIS config.Scope: useris only correctwhile electron-builder stays per-user, which is the other thing the Publish a winget manifest for Windows installs #47
comment flags — the test fails if
perMachineis ever turned on withoutmoving the manifest with it.
Release notes
None. No file under
src/,resources/orpackage.jsonchanges, so therelease-notes check passes without a
CHANGELOG.mdline and without the label:How did you test it?
npm testnpm run typechecknpm run lintsrc/changes, so preview/export parity is untouched
Beyond the suite:
The fixture is real, not synthetic. The generator was run against the live
v0.13.0release and the trio passed. The hash it wrote was cross-checkedagainst GitHub's own digest for the real 208 MB installer
(
7A1AD50C…8B152B), and the URL against the asset that is actually published.The emitted manifest is unchanged. Output from
mainand from this branchis byte-for-byte identical, in both
--out DIRand stdout mode:The checks actually fire.
tests/wingetManifest.test.tsgoes from 2 to 15tests, and each bad-manifest case asserts the exact problem reported rather
than only that something failed. Covered: a bad hash, a version that disagrees
across the trio, a missing required locale field, a licence below the minimum,
an unsupported architecture, a URL that does not name the versioned asset,
duplicate tags, a non-http URL, a one-part identifier, a version with a
forbidden character, and scope drift from
package.json.The failure path was exercised by hand as well as in tests: with
perMachine: truethe CLI refuses to write and explains why.Anything to watch out for?
microsoft/winget-pkgs— needs a fork of that repo andWINGET_TOKEN, so itcan only be done from the maintainer side.
winget install JeremySNR.Cutawandoes not work until that lands, which is why this says "refs" rather than
"fixes".
of their pipeline that need Windows — the installer actually installing and
uninstalling — or the manual review.
uses:areactions/*,which is a separate call worth making on purpose.
Note
Medium Risk
Changes release CI supply-chain handling for a PAT-backed action and adds gates that can block manifest generation if packaging config drifts; no app runtime impact.
Overview
Hardens the winget publish path so bad manifests fail locally and the release workflow does not run unreviewed third-party code with a PAT.
print-winget-manifest.mjsnow validates the three generated YAML files against winget 1.6.0 schema rules (required fields, enums, locale length limits, SHA256/URLs, cross-file identifier/version/locale alignment) and repo-specific checks (installer URL must include the release version;Scopemust match electron-builder NSIS settings inpackage.json). Validation runs on the emitted YAML bytes viajs-yaml; if anything fails, the script errors and writes nothing.The Release workflow pins
vedantmgoyal9/winget-releaserto commitf29ed1f…instead of the moving@v2tag, since that action usesWINGET_TOKEN.docs/winget.mddocuments both behaviors and how to bump the pin.tests/wingetManifest.test.tsadds coverage forvalidateManifestsand scope derivation (many rejection cases).Reviewed by Cursor Bugbot for commit fe2bffa. Bugbot is set up for automated code reviews on this repo. Configure here.