ci(nightly): surface a clear error when the Gitea API rejects the audit token #840
Reference in New Issue
Block a user
Delete Branch "devops/issue-839-nightly-audit-clear-error"
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?
What
The
npm-auditjob innightly.ymlfiled its tracking issue viacurl -sf, which collapses every HTTP >= 400 into a bareexit 22. WhenNIGHTLY_AUDIT_TOKENis rejected (missing/expired/under-scoped), the step died with an opaqueexitcode '22'and no hint at the cause — exactly what happened on run #6707 (the audit correctly found thetmphigh advisory, then couldn't authenticate to file the issue).Change
api()helper that reads the HTTP status code and, on >= 400, emits an actionable::error::naming the status and theNIGHTLY_AUDIT_TOKENsecret (value/scope) before failing the step — never echoing the token value.curlcheck covering both the success path (2xx returns body) and the error path (>= 400 emits::error::, fails).Behaviour on success is unchanged; the step still fails non-zero on error (clarity does not mask the failure).
Verification
::error::, return non-zero; token never leaked).curl: create-new and update-existing paths both work; a 401-on-create now prints a clear::error::and fails cleanly instead ofexit 22.set -eo pipefail; YAML parses;npm run lintclean.Note (not in this PR)
This only fixes the opaque failure mode. The job will still go red by design (
exit "$AUDIT_EXIT") while the realtmpadvisory (GHSA-ph9p-34f9-6g65) is open, and the token itself must be repaired operationally (recreate therenovate_botPAT with issue read+write scope and update the secret).Closes #839
🤖 Generated with Claude Code