fix(renovate): authenticate git with a bearer header and fail the job on repository errors #21

Merged
Defame1297 merged 1 commits from fix/renovate-git-auth into main 2026-10-26 08:45:26 +00:00
Owner

Fixes the first dry run of the Renovate workflow (Actions run 2439), which never got past the clone and still reported success.

What the dry run showed

  • The Gitea REST API worked with the job token (Gitea 28.0.0, repository started, default branch main).
  • The first git call failed five times: ls-remote https://<token>@git.rkdr.net/Mortis/Kamino.git printed redirecting to https://git.rkdr.net/Mortis/Kamino.git/ and then could not read Username. Renovate gave up with external-host-error (cloned: false, repository exit code 7).
  • The job was green, because the Renovate process exits 0 when a repository fails. As built, a broken nightly run would look successful.
  • Nothing was created (no branches, PRs or issues). renovate.json and postUpgradeTasks were never read.

Changes (.gitea/workflows/renovate.yml, CLAUDE.md, CONTRIBUTING.md)

  • Git auth: the step writes a global git config before Renovate starts: http.<server_url>/.extraheader = AUTHORIZATION: bearer $RENOVATE_TOKEN, the same header lint.yml already uses to clone this repo with the job token. Git sends it on every request to the host, including after a redirect, and Renovate's git children find it through HOME. The token appears only through RENOVATE_TOKEN: ${{ secrets.GITHUB_TOKEN }} in env:. User-supplied GIT_CONFIG_* variables are not passed to Renovate's git children (Renovate 44.161.0 util/exec/env.js), so that route would have been silently dropped. Hostrules/gitUrl=endpoint keep the token in the URL, which is what failed.
  • Fail the job: RENOVATE_EXIT_CODE_FOR_ERRORS=true makes a failed repository exit 7. Renovate also writes a JSON report (RENOVATE_REPORT_TYPE=file), and an inline python3 -I -c check fails the job on a missing/unreadable report or any ERROR/FATAL problem. Warnings do not fail it. The checker was tested on five synthetic reports (no file, warnings only, ERROR, FATAL, invalid JSON).
  • Docs describe the auth and what a successful dry run must show.

Verified

  • actionlint, yamllint and the commit hooks pass; 120 script tests pass.

Not verified (the next dry run settles these)

  • That the global gitconfig is read by Renovate's git children (assumes HOME is the same and writable).
  • That Gitea accepts the bearer header for Renovate's ls-remote and fetch (lint.yml proves it only for a plain clone).
  • Why Gitea redirected the clone in the first place.
  • That a clone failure now surfaces as exit 7.
  • The token is readable through the gitconfig by postUpgradeTasks children; they run only the one allowlisted command.

What the next dry run must show

No could not read Username and no External host error; stats cloned: true; a Repository started line followed by branch-plan lines; a post-upgrade task line for python3 scripts/bump_image_versions.py origin/main with no not allowed message; the report written and the step ending with exit 0.

🤖 Generated with Claude Code

Fixes the first dry run of the Renovate workflow (Actions run 2439), which never got past the clone and still reported success. ## What the dry run showed - The Gitea REST API worked with the job token (Gitea 28.0.0, repository started, default branch `main`). - The first git call failed five times: `ls-remote https://<token>@git.rkdr.net/Mortis/Kamino.git` printed `redirecting to https://git.rkdr.net/Mortis/Kamino.git/` and then `could not read Username`. Renovate gave up with `external-host-error` (`cloned: false`, repository exit code 7). - The job was green, because the Renovate process exits 0 when a repository fails. As built, a broken nightly run would look successful. - Nothing was created (no branches, PRs or issues). `renovate.json` and `postUpgradeTasks` were never read. ## Changes (`.gitea/workflows/renovate.yml`, `CLAUDE.md`, `CONTRIBUTING.md`) - **Git auth:** the step writes a global git config before Renovate starts: `http.<server_url>/.extraheader = AUTHORIZATION: bearer $RENOVATE_TOKEN`, the same header `lint.yml` already uses to clone this repo with the job token. Git sends it on every request to the host, including after a redirect, and Renovate's git children find it through `HOME`. The token appears only through `RENOVATE_TOKEN: ${{ secrets.GITHUB_TOKEN }}` in `env:`. User-supplied `GIT_CONFIG_*` variables are not passed to Renovate's git children (Renovate 44.161.0 `util/exec/env.js`), so that route would have been silently dropped. Hostrules/`gitUrl=endpoint` keep the token in the URL, which is what failed. - **Fail the job:** `RENOVATE_EXIT_CODE_FOR_ERRORS=true` makes a failed repository exit 7. Renovate also writes a JSON report (`RENOVATE_REPORT_TYPE=file`), and an inline `python3 -I -c` check fails the job on a missing/unreadable report or any ERROR/FATAL problem. Warnings do not fail it. The checker was tested on five synthetic reports (no file, warnings only, ERROR, FATAL, invalid JSON). - Docs describe the auth and what a successful dry run must show. ## Verified - `actionlint`, yamllint and the commit hooks pass; 120 script tests pass. ## Not verified (the next dry run settles these) - That the global gitconfig is read by Renovate's git children (assumes `HOME` is the same and writable). - That Gitea accepts the bearer header for Renovate's `ls-remote` and fetch (`lint.yml` proves it only for a plain clone). - Why Gitea redirected the clone in the first place. - That a clone failure now surfaces as exit 7. - The token is readable through the gitconfig by `postUpgradeTasks` children; they run only the one allowlisted command. ## What the next dry run must show No `could not read Username` and no `External host error`; stats `cloned: true`; a `Repository started` line followed by branch-plan lines; a post-upgrade task line for `python3 scripts/bump_image_versions.py origin/main` with no `not allowed` message; the report written and the step ending with exit 0. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claude added 1 commit 2026-10-26 08:43:24 +00:00
fix(renovate): authenticate git with a bearer header and fail the job on repository errors
Molecule / molecule (pull_request) Skipped
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Successful in 12s
7e32ad5ac6
Renovate puts the job token in the clone URL, which git drops when the
server redirects (dry run 2439: could not read Username). Write a global
git http.extraheader like lint.yml does. Renovate exits 0 on a repository
failure: set exitCodeForErrors and check the JSON report for a missing
file or ERROR/FATAL problems.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Defame1297 merged commit 56f782f5c2 into main 2026-10-26 08:45:26 +00:00
Defame1297 deleted branch fix/renovate-git-auth 2026-10-26 08:45:26 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#21