Add WINGET_TOKEN preflight to unmask komac's error#150
Merged
Conversation
komac collapses every HTTP error on its package-existence check into '<id> does not exist in microsoft/winget-pkgs', hiding the real cause. The package demonstrably exists at the correct path/casing, so a masked error there means the token is rejected. This preflight step runs the same reads (REST /user, package contents, GraphQL viewer) with WINGET_TOKEN and prints the true HTTP status, token scopes, and authenticated user, failing fast with actionable guidance when the token is invalid. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Problem
winget-publishkeeps failing with:But the package does exist at the correct path and casing —
manifests/b/BaldBeardedBuilder/WeatherforCommandPalettecurrently holds versions1.0.1.0,1.0.4.0,1.0.4,1.2.1.0. komac v2.16.0 collapses every HTTP error on its existence check into that "does not exist" message, so the real cause is hidden. Reading a public repo needs no special scope, so a masked error there almost always means the token is being rejected (401).You've re-issued
WINGET_TOKENtwice and it still fails, so we need to see the actual HTTP status instead of komac's masked message.What this adds
A preflight step that runs before
winget-releaser, using the sameWINGET_TOKEN, and prints the ground truth:GET /user→ HTTP status,x-oauth-scopes(classic PATs list scopes here; fine-grained PATs return an empty scopes header), and the authenticated login.GETthe package manifest folder inmicrosoft/winget-pkgs→ HTTP status.POST /graphqlviewer query → HTTP status (komac uses the GraphQL API, so this mirrors it most closely).It also warns if the secret has surrounding whitespace, and fails fast with actionable guidance if
/useror GraphQL returns non-200.How to use it
Merge this and cut a release (or re-run). The preflight output tells us definitively:
/user= 401 → the token value is invalid/expired/mis-pasted./user= 200 butx-oauth-scopesis empty → it's a fine-grained PAT; komac needs a classic PAT withpublic_repo.No secrets are printed — only HTTP statuses, scopes, and the login name.
Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com