devops(ci): nightly npm-audit fails with an opaque exit 22 when the Gitea API rejects NIGHTLY_AUDIT_TOKEN #839
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When the
npm-auditjob in.gitea/workflows/nightly.ymlfinds a high/critical advisory, it tries to file/patch a Gitea tracking issue viacurl -sf. If the Gitea API rejects the request (HTTP >= 400 — e.g. theNIGHTLY_AUDIT_TOKENsecret is missing, expired, or lacks issue read+write scope),curl --failexits 22 andset -eaborts the step with a bare:No indication that the cause is the token. This already bit us: run #6707 failed with exit 22 because the audit correctly found the
tmphigh advisory (GHSA-ph9p-34f9-6g65, viapatch-package), then could not authenticate to file the tracking issue. The failure was indistinguishable from a logic bug.Root cause
curl -sfcollapses every HTTP error into exit 22 with no message. The five API calls in the audit branch (list issues, patch, create, list labels, add labels) all share this failure mode.Acceptance criteria
::error::annotation naming the HTTP status and pointing at theNIGHTLY_AUDIT_TOKENsecret (value/scope) as the likely cause, instead of a bareexitcode 22.NIGHTLY_AUDIT_TOKENvalue MUST NOT appear in logs or in the error message.::error::, fails) and the success path (returns body) using a mocked transport.Out of scope
tmpadvisory itself (separate dependency bump).NIGHTLY_AUDIT_TOKENPAT (operational, not code).