renovate: catch customManagers that match no file #17

Open
deadstyle wants to merge 1 commit from chore/renovate-pattern-guide into main
Owner

Summary

RENOVATE.md's example customManagers rule used "managerFilePatterns": ["^\\.forgejo/workflows/ci\\.yml$"]. Renovate reads a bare string there as a glob, so it matches no file, and the rule tracks nothing. The config validator accepts it, so nothing ever flagged it. Two repos copied the pattern:

  • kirria: its golangci-lint and templ rules had never matched. Fixed in kirria/kirria#1170 (merged).
  • lazyforge: same for golangci-lint and govulncheck. Fixed in its own MR.

A read-only scan of every repo on the instance with a Renovate config (22 of 49) found no others. garage, invoice-ninja, jellyfin and valkey already wrap their patterns correctly.

Changes:

  • renovate/check-custom-managers (new): run it from any repo root. It runs the bot's own Renovate version (read from .forgejo/workflows/renovate.yml) in extract-only mode, against a snapshot of the working tree with the local> preset stripped, since the local platform can't fetch it. It lists every dependency the custom rules found, and exits 1 when they found nothing, or when a rule with a fixed depNameTemplate found nothing.
  • RENOVATE.md:
    • the slash-wrapping rule, and why the validator misses it
    • prefer pattern-based rules over one rule per tool
    • group custom dependencies by matchDatasources
    • the example rewritten to the working, pattern-based form kirria now uses
    • the new check added to step 2
    • a troubleshooting row

No change to renovate/default.json or the workflow, so nothing changes for onboarded repos on merge.

Verification

renovate/check-custom-managers against three configs:

=== lazyforge develop (broken)
Renovate 44.115.13: 0 dependencies from 2 customManagers
FAIL  no file matched the customManager for golangci/golangci-lint
FAIL  no file matched the customManager for golang.org/x/vuln
exit 1
=== lazyforge fix branch
Renovate 44.115.13: 5 dependencies from 3 customManagers
  .forgejo/workflows/ci.yml: golangci/golangci-lint 2.13.2 [github-releases]
  .forgejo/workflows/release.yml: golangci/golangci-lint 2.13.2 [github-releases]
  Makefile: golang.org/x/vuln v1.8.0 [go]
  .forgejo/workflows/ci.yml: koalaman/shellcheck v0.11.0 [github-releases]
  .forgejo/workflows/release.yml: koalaman/shellcheck v0.11.0 [github-releases]
exit 0
=== kirria (merged #1170)
Renovate 44.115.13: 25 dependencies from 4 customManagers

Both JSON examples in RENOVATE.md parse. The file was formatted with prettier 3.3.3 using the repo's .prettierrc.

I first tried a one-line check using Renovate's RENOVATE_IGNORE_PRESETS. It doesn't work: Renovate still fetches the local> preset and aborts with "does not support local presets". That is why the check needs a script that strips the preset reference from a snapshot.

🤖 Generated with Claude Code

## Summary `RENOVATE.md`'s example `customManagers` rule used `"managerFilePatterns": ["^\\.forgejo/workflows/ci\\.yml$"]`. Renovate reads a bare string there as a **glob**, so it matches no file, and the rule tracks nothing. The config validator accepts it, so nothing ever flagged it. Two repos copied the pattern: - **kirria**: its golangci-lint and templ rules had never matched. Fixed in kirria/kirria#1170 (merged). - **lazyforge**: same for golangci-lint and govulncheck. Fixed in its own MR. A read-only scan of every repo on the instance with a Renovate config (22 of 49) found no others. garage, invoice-ninja, jellyfin and valkey already wrap their patterns correctly. Changes: - **`renovate/check-custom-managers`** (new): run it from any repo root. It runs the bot's own Renovate version (read from `.forgejo/workflows/renovate.yml`) in extract-only mode, against a snapshot of the working tree with the `local>` preset stripped, since the local platform can't fetch it. It lists every dependency the custom rules found, and exits 1 when they found nothing, or when a rule with a fixed `depNameTemplate` found nothing. - **`RENOVATE.md`**: - the slash-wrapping rule, and why the validator misses it - prefer pattern-based rules over one rule per tool - group custom dependencies by `matchDatasources` - the example rewritten to the working, pattern-based form kirria now uses - the new check added to step 2 - a troubleshooting row No change to `renovate/default.json` or the workflow, so nothing changes for onboarded repos on merge. ## Verification `renovate/check-custom-managers` against three configs: ``` === lazyforge develop (broken) Renovate 44.115.13: 0 dependencies from 2 customManagers FAIL no file matched the customManager for golangci/golangci-lint FAIL no file matched the customManager for golang.org/x/vuln exit 1 === lazyforge fix branch Renovate 44.115.13: 5 dependencies from 3 customManagers .forgejo/workflows/ci.yml: golangci/golangci-lint 2.13.2 [github-releases] .forgejo/workflows/release.yml: golangci/golangci-lint 2.13.2 [github-releases] Makefile: golang.org/x/vuln v1.8.0 [go] .forgejo/workflows/ci.yml: koalaman/shellcheck v0.11.0 [github-releases] .forgejo/workflows/release.yml: koalaman/shellcheck v0.11.0 [github-releases] exit 0 === kirria (merged #1170) Renovate 44.115.13: 25 dependencies from 4 customManagers ``` Both JSON examples in `RENOVATE.md` parse. The file was formatted with prettier 3.3.3 using the repo's `.prettierrc`. I first tried a one-line check using Renovate's `RENOVATE_IGNORE_PRESETS`. It doesn't work: Renovate still fetches the `local>` preset and aborts with "does not support local presets". That is why the check needs a script that strips the preset reference from a snapshot. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
renovate: catch customManagers that match no file
All checks were successful
YAML Lint and Fix / yaml-lint-fix (push) Successful in 12s
YAML Lint and Fix / yaml-lint-fix (pull_request) Successful in 15s
38f8177627
managerFilePatterns entries are globs unless wrapped in /…/, so the guide's
own example (a bare ^…$ regex) matched nothing, and kirria and lazyforge both
copied it: their custom rules tracked no dependency. The config validator
accepts that, so add renovate/check-custom-managers, which runs the bot's
Renovate in extract-only mode on a repo snapshot and fails when the custom
rules find nothing. Fix the example and document the slash rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All checks were successful
YAML Lint and Fix / yaml-lint-fix (push) Successful in 12s
YAML Lint and Fix / yaml-lint-fix (pull_request) Successful in 15s
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin chore/renovate-pattern-guide:chore/renovate-pattern-guide
git switch chore/renovate-pattern-guide

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff chore/renovate-pattern-guide
git switch chore/renovate-pattern-guide
git rebase main
git switch main
git merge --ff-only chore/renovate-pattern-guide
git switch chore/renovate-pattern-guide
git rebase main
git switch main
git merge --no-ff chore/renovate-pattern-guide
git switch main
git merge --squash chore/renovate-pattern-guide
git switch main
git merge --ff-only chore/renovate-pattern-guide
git switch main
git merge chore/renovate-pattern-guide
git push origin main
Sign in to join this conversation.
No reviewers
No labels
maintenance
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
deadstyle/forgejo!17
No description provided.