fix(renovate): authenticate as a Kamino-only bot user, not the job token
Molecule / molecule (pull_request) Skipped
Build / build (pull_request) Successful in 10s
Lint / lint (pull_request) Successful in 12s

Dry run 2445 showed Renovate cannot run on the job token: its pull request lookups filter by its own username, which is the virtual user gitea-actions, and Gitea answers 400 user does not exist. The workflow now reads the repository secret RENOVATE_BOT_TOKEN (token of a bot user with write access to this repository only); the job token is read-only. The empty-secret case fails with a clear message. Docs updated.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
This commit is contained in:
Defame1297andClaude Sonnet 5.5 committed 2026-10-26 08:51:22 +00:00
1 parent 56f782f5c2
commit 4628989be3
3 files changed
+40 -32

No files matched your search

+16 -10
View File
@@ -2,9 +2,12 @@ name: Renovate
# Dependency updates for this repository (renovate.json). Runs on the Collection's own runner
# (label kamino-docker, the untrusted side), never in the production cluster: code from this
# repository must not run there. The only credential is the job token (secrets.GITHUB_TOKEN);
# no org secret is referenced (only image.yml may). Unauthenticated GitHub lookups for the
# github.com pre-commit hooks may hit rate limits: best effort, no RENOVATE_GITHUB_COM_TOKEN exists.
# repository must not run there. The credential is the token of a Kamino-only bot user, held as
# the repository secret RENOVATE_BOT_TOKEN (not an org secret: only image.yml may reference those).
# The job token cannot be used: Renovate filters every pull request lookup by its own username,
# which is the virtual user gitea-actions with the job token, and Gitea answers 400 "user does not
# exist" (dry run 2445). Unauthenticated GitHub lookups for the github.com pre-commit hooks may
# hit rate limits: best effort, no RENOVATE_GITHUB_COM_TOKEN exists.
#
# Dry run: Actions > Renovate > Run workflow, dry_run=true (the default for a manual run), then
# read the debug log. The schedule runs live.
@@ -22,10 +25,9 @@ on: # yamllint disable-line rule:truthy
- "false"
default: "true"
# The job token is not used for Renovate (see above): read-only is enough for the job itself.
permissions:
contents: write
pull-requests: write
issues: write
contents: read
# Never two runs at once; a running one is not cancelled (it may be mid-push).
concurrency:
@@ -34,7 +36,7 @@ concurrency:
jobs:
renovate:
# Only in this repository (a copy elsewhere would run with its own job token).
# Only in this repository (a copy elsewhere has no such secret).
if: github.repository == 'mortis/kamino' || github.repository == 'Mortis/Kamino'
runs-on: kamino-docker
timeout-minutes: 30
@@ -49,7 +51,7 @@ jobs:
RENOVATE_PLATFORM: gitea
RENOVATE_ENDPOINT: ${{ github.server_url }}/api/v1/
RENOVATE_REPOSITORIES: ${{ github.repository }}
RENOVATE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RENOVATE_TOKEN: ${{ secrets.RENOVATE_BOT_TOKEN }}
# Git auth: see the run block. The host the header is scoped to.
GIT_HOST_URL: ${{ github.server_url }}/
RENOVATE_GIT_AUTHOR: "Renovate Bot <[email protected]>"
@@ -66,10 +68,14 @@ jobs:
# exactly the string "false" (an empty input from an API or CLI dispatch stays a dry run).
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run != 'false' && 'true' || 'false' }}
run: |
# Git over HTTPS with the job token. Renovate's own rewrite puts the token in the URL
if [ -z "$RENOVATE_TOKEN" ]; then
echo "::error::The repository secret RENOVATE_BOT_TOKEN is not set (token of the Kamino-only bot user)"
exit 1
fi
# Git over HTTPS with the bot token. Renovate's own rewrite puts the token in the URL
# (https://<token>@host/...), which git drops when the server redirects, and Gitea
# redirected the clone (dry run 2439). The header is sent on every request to the host,
# as lint.yml does. Renovate does not pass GIT_CONFIG_* from its environment to git
# as lint.yml does with its token. Renovate does not pass GIT_CONFIG_* from its environment to git
# (only an allowlist, util/exec/env.js), but it does pass HOME, so a global git config
# is the path that reaches its git children. The token is read from the environment.
git config --global "http.${GIT_HOST_URL}.extraheader" "AUTHORIZATION: bearer ${RENOVATE_TOKEN}"