ci(deps): make Renovate read the lock and look the hooks up without a token #132

Merged
Defame1297 merged 1 commits from fix/renovate-lock-and-hooks into main 2026-11-14 21:53:11 +00:00
6 changed files with 34 additions and 5 deletions

No files matched your search

+1 -1
View File
@@ -88,7 +88,7 @@ jobs:
dockerfile: Dockerfile
job_image: ubuntu:26.04@sha256:6a06111c3b0a8600feadb270aec771dc239bf407b25625f93f44ab00e11f4d3c
- name: ci
version: 0.2.19
version: 0.2.20
subpath: ""
dockerfile: images/ci/Dockerfile
job_image: ubuntu:26.04@sha256:6a06111c3b0a8600feadb270aec771dc239bf407b25625f93f44ab00e11f4d3c
+8 -2
View File
@@ -6,8 +6,11 @@ name: Renovate
# 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.
# exist" (dry run 2445). No GitHub token exists (no RENOVATE_GITHUB_COM_TOKEN): the github-tags
# datasource then skips every pre-commit hook (skipReason github-token-required, dry run 3880), and
# unauthenticated GitHub API lookups are refused at once (403 rate limit). The hooks are looked up
# with git ls-remote instead (renovate.json, packageRule overrideDatasource git-tags), which needs
# RENOVATE_GITHUB_TOKEN_WARN=false below: the token check runs before package rules apply.
#
# Dry run: Actions > Renovate > Run workflow, dry_run=true (the default for a manual run), then
# read the debug log. The schedule runs live.
@@ -55,6 +58,9 @@ jobs:
# 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]>"
# No GitHub token exists, and the hooks go through git-tags (see the header). Without this
# Renovate marks every github-tags dependency as skipped before the package rule applies.
RENOVATE_GITHUB_TOKEN_WARN: "false"
# postUpgradeTasks may run exactly this one command (anchored, no wildcard); the JSON
# string holds a regex, hence the doubled backslash.
RENOVATE_ALLOWED_COMMANDS: '["^python3 scripts/bump_image_versions\\.py origin/main$"]'
+8
View File
@@ -131,7 +131,15 @@ maintainer's production environment. Never reuse another Renovate credential her
pip refuses an unhashed package and any disagreement between the two). Renovate's `pip-compile` manager bumps
a pin and regenerates the lock by replaying the lock's header command; a weekly lock-file-maintenance PR
moves transitive packages and is never automerged. By hand: `scripts/lock-requirements.sh [--upgrade]`.
The header must hold only options Renovate knows: it refuses `--newline=LF` ("not supported (yet)"),
extracts nothing, and proposes no bump, with only a WARN in an otherwise green run.
Hook repositories in `.pre-commit-config.yaml` are pinned by commit SHA with a `# frozen: vX.Y.Z` comment.
Renovate looks them up with `git ls-remote` (packageRule `overrideDatasource: git-tags` plus
`RENOVATE_GITHUB_TOKEN_WARN=false` in `renovate.yml`), because there is no GitHub token and the default
`github-tags` lookup is skipped or rate limited. A hook bump is never automerged: `git-tags` has no release
timestamps, so `minimumReleaseAge` cannot delay it. After a Renovate config change, test it locally before
the merge: `renovate --platform=local` (same version as `renovate.yml`) reads this checkout; a dry run in
Actions reads `renovate.json` from `main`.
- **Bot-diff gate:** `scripts/check_bot_pr_diff.py` runs in the lint workflow, from `origin/main`'s copy so a
pull request cannot weaken it. A `renovate/` head ref may only change version lines (tool pins and their lock
entries and hashes, hook `rev:` lines, Dockerfile FROM tags and digests, matrix `version:` lines, `job_image:` pins, consumer image pins);
+12
View File
@@ -179,6 +179,18 @@
"git.rkdr.net/mortis/**"
],
"automerge": true
},
{
"description": "Look the pre-commit hook repositories up with git ls-remote (git-tags) instead of the GitHub API. This run has no GitHub token, and the github-tags datasource then either skips every hook (skipReason github-token-required, dry run 3880) or is refused at once with 403 rate limit (githubTokenWarn off, local run). git-tags needs no API and no credential, and it uses the dereferenced hash of an annotated tag, so the new rev is the commit, as pre-commit needs. The `# frozen:` form is kept by the manager's own replace template. It works only together with RENOVATE_GITHUB_TOKEN_WARN=false in renovate.yml: the token check runs after extraction and skips every github-tags dependency before a package rule can change its datasource (local run, Renovate 44.161.0). git-tags has no release timestamps, so minimumReleaseAge cannot delay a hook bump: hook bumps are never automerged, a person reviews each one.",
"matchManagers": [
"pre-commit"
],
"matchDatasources": [
"github-tags"
],
"overrideDatasource": "git-tags",
"overridePackageName": "https://github.com/{{{depName}}}",
"automerge": false
}
],
"lockFileMaintenance": {
+1 -1
View File
@@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.13
# by the following command:
#
# pip-compile --allow-unsafe --generate-hashes --newline=LF --output-file=requirements-dev.lock --strip-extras requirements-dev.txt
# pip-compile --allow-unsafe --generate-hashes --output-file=requirements-dev.lock --strip-extras requirements-dev.txt
#
aiofiles==25.1.0 \
--hash=sha256:a8d728f0a29de45dc521f18f07297428d56992a742f0cd2701ba86e44d23d5b2 \
+4 -1
View File
@@ -18,6 +18,9 @@
#
# Renovate runs the same command from the header of the lock (pip-compile manager, renovate.json),
# so keep the header: do not add --no-header, and keep the flags below in step with renovate.json.
# Renovate's pip-compile manager refuses a header with an option it does not know ("Option
# --newline=LF not supported (yet)", dry run 3880): it then extracts nothing and proposes no bump.
# So no --newline here: pip-compile keeps the lock's own line endings (LF on Linux) by default.
set -euo pipefail
pip_version="25.2"
@@ -44,6 +47,6 @@ trap 'rm -rf "$tmp"' EXIT
cd "$root"
# --allow-unsafe: setuptools is a dependency of a tool here, and pip refuses an unpinned
# requirement in a file that carries hashes.
"$tmp/venv/bin/pip-compile" --quiet --generate-hashes --strip-extras --allow-unsafe --newline lf \
"$tmp/venv/bin/pip-compile" --quiet --generate-hashes --strip-extras --allow-unsafe \
"${upgrade[@]}" --output-file requirements-dev.lock requirements-dev.txt
echo "requirements-dev.lock regenerated; commit it with requirements-dev.txt."