@sigitcode-old / sigit / commits / 049c32e
Fork 1

I'm siGit, running on siGit Code & Deploy platform, browsing siGit Code coding agent repo.

Fail the winget check on an unexpected status instead of guessing

The v1.7.7 run hit a GitHub outage while checking whether getSigit.siGitCode is in winget-pkgs. The check counted any failed `gh api` call as "not there", so it took the new-package path and opened a bogus Package Request (microsoft/winget-pkgs#465415) for a package that has been there since 1.7.4. It now branches on the status code the way the NuGet and PyPI checks do: 200 means update, 404 means new package, and anything else fails the job before an issue or PR is opened, so a rerun is safe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

foodandtravel committed Oct 29, 2026 at 22:09 UTC 049c32ed34eab77dab4dd791f592d7ae238fbbee
1 file changed +27 -7
.github/workflows/release-winget.yml
+27 -7
@@ -73,13 +73,33 @@ jobs:
73 FIRST=$(echo "${PUBLISHER:0:1}" | tr '[:upper:]' '[:lower:]')
74 PATH_IN_REPO="manifests/${FIRST}/${PUBLISHER}/${NAME}"
75
76 - if gh api "repos/microsoft/winget-pkgs/contents/${PATH_IN_REPO}" >/dev/null 2>&1; then
77 - echo "Found ${PACKAGE_IDENTIFIER} at ${PATH_IN_REPO}; submitting an update."
78 - echo "found=true" >> "$GITHUB_OUTPUT"
79 - else
80 - echo "No ${PACKAGE_IDENTIFIER} at ${PATH_IN_REPO}; submitting it as a new package."
81 - echo "found=false" >> "$GITHUB_OUTPUT"
82 - fi
76 + # Branch on the status code, not on whether the request worked.
77 + # This used to treat any failure as "not there", so a GitHub outage
78 + # during the v1.7.7 run sent an existing package down the
79 + # new-package path and filed a bogus Package Request
80 + # (microsoft/winget-pkgs#465415). Only a 404 means "not there";
81 + # anything else fails the job before an issue or PR is opened, so a
82 + # rerun is safe.
83 + STATUS=$(curl -sS -o /dev/null -w '%{http_code}' \
84 + --retry 5 --retry-delay 10 --retry-all-errors \
85 + -H "Authorization: Bearer ${GH_TOKEN}" \
86 + -H "Accept: application/vnd.github+json" \
87 + "https://api.github.com/repos/microsoft/winget-pkgs/contents/${PATH_IN_REPO}") || true
88 +
89 + case "$STATUS" in
90 + 200)
91 + echo "Found ${PACKAGE_IDENTIFIER} at ${PATH_IN_REPO}; submitting an update."
92 + echo "found=true" >> "$GITHUB_OUTPUT"
93 + ;;
94 + 404)
95 + echo "No ${PACKAGE_IDENTIFIER} at ${PATH_IN_REPO}; submitting it as a new package."
96 + echo "found=false" >> "$GITHUB_OUTPUT"
97 + ;;
98 + *)
99 + echo "Unexpected ${STATUS:-no response} from GitHub checking ${PATH_IN_REPO}; refusing to guess" >&2
100 + exit 1
101 + ;;
102 + esac
103
104 - name: Render manifests for a first submission
105 if: steps.exists.outputs.found == 'false'