ci(renovate): the RENOVATE_TOKEN 403 is a scope gap (missing user scope), not a stale token #8
No reviewers
Labels
No labels
dependencies
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
alex/pi-shared!8
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/renovate-token-scope-diagnosis"
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?
The token is NOT stale
I verified this against the running Forgejo instance:
GET /userRENOVATE_TOKEN(from the job log)Forgejo returns 401 when it doesn't recognize a token, and 403 only after it has recognized the token and found it lacks the required scope. A 403 means your token is valid and was recognized — the previous "likely stale" message was misleading.
Root cause: missing
userscopeGET /userrequires auserscope. Every prior instruction listed scopesissue, repository, workflowand omitteduser(whileworkflowis GitHub-only and doesn't exist on Forgejo — that's why it can't be found in the UI). So your PAT works fine on repo/issue operations (which is why it looks correct to you), but dies onGET /user— which is Renovate's very first call at startup. That single missing scope explains the entire failure history (Renovate's opaqueAuthentication failureat init, and now the validate step's403).What you need to do (the only manual step)
Recreate the PAT with these scopes (no
workflow):read:user(oruser:readfine-grained)GET /userat startup — the missing onewrite:repositorywrite:issueThen update the
RENOVATE_TOKENsecret and re-run the workflow.Quick self-test (the
(b)probe also confirms write access):If
useris 403 → add theuserscope. Ifwriteis 403 → usewrite:repository(not read).What this PR changes
Rewrites the Validate Renovate token step so the next failure names the exact cause instead of Renovate's opaque
Authentication failure:userscope and the correct full set, and drops the non-existentworkflowfrom all messages;repositoryscope too).Verified on the runner: YAML parses,
bash -npasses, the step script runs green with a valid token and emits the correct 401 message with an invalid one.The 'Validate Renovate token' step treated any non-200 on GET /user as a 'stale token'. But a 403 is NOT a stale token: Forgejo returns 401 for an unrecognized token and 403 only after it has recognized the token and found it lacks the required scope. Every prior instruction listed scopes 'issue, repository, workflow' and omitted 'user', so the PAT (valid for repo ops) has always failed GET /user - Renovate's first startup call - with a 403. (workflow is GitHub-only and does not exist on Forgejo.) Rewrite the validation step to: - distinguish 401 (unrecognized: stale/typo/whitespace) from 403 (recognized: scope gap), printing Forgejo's own 403 body for the exact reason; - name the missing 'user' scope and the correct full set (read:user + write:repository + write:issue), dropping the non-existent 'workflow' scope from all messages; - verify repository WRITE access via a create+delete branch probe, so a read-only repository scope is caught too.For the records, it was also missing
organizationread. Docs here for reference: https://docs.renovatebot.com/modules/platform/forgejo/Pull request closed