Skip to content

chore(pre-commit): validate the shared renovate presets - #2213

Open
cardoe wants to merge 1 commit into
mainfrom
renovate-validate-presets
Open

chore(pre-commit): validate the shared renovate presets#2213
cardoe wants to merge 1 commit into
mainfrom
renovate-validate-presets

Conversation

@cardoe

@cardoe cardoe commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Why

The renovate-config-validator hook's default files pattern is (^|/).?renovate(?:rc)?(?:\.json5?)?$. That matches .github/renovate.json, but not .github/renovate/*.json — so the shared presets that this repo and RSS-Engineering/undercloud-deploy both extend have never been validated locally.

This was noticed concretely: the fileMatchmanagerFilePatterns rename in #2212 reported renovate-config-validator .... Skipped (no files to check). A typo in a preset would have shipped silently, and because both repos extend these presets unpinned (no #ref), a broken preset takes effect on the next Renovate run of either repo with no PR to catch it.

Verification

Coverage — matching the new pattern against git ls-files (both = already covered, NEW = newly covered):

both  .github/renovate.json
NEW   .github/renovate/automergeGitHubActions.json
NEW   .github/renovate/default.json
NEW   .github/renovate/mariadb-operator.json
NEW   .github/renovate/matchOpenStackHelm.json
NEW   .github/renovate/nautobot.json
NEW   .github/renovate/precommit.json
NEW   .github/renovate/understackContainerMatch.json

No other path in the repo is pulled in.

All seven presets pass as-is, so this does not land red: prek run renovate-config-validator --all-filesPassed (exit 0), no warnings.

The hook can actually fail — injecting an unknown option (grupName) into .github/renovate/nautobot.json gives renovate-config-validator ... Failed. An invalid regex in matchStrings is caught too.

One limit worth recording: the validator is lenient about some shapes — matchPackageNames given a bare string instead of an array validates fine, because Renovate coerces it. So this catches unknown options and malformed regexes, not every possible mistake.

Note

Preset files are validated as global config (INFO: Validating <file> as global config), since the hook passes filenames as arguments. That is fine for these files and is how the existing renovate.json check already behaves.

🤖 Generated with Claude Code

The renovate-config-validator hook's default files pattern is
(^|/).?renovate(?:rc)?(?:\.json5?)?$, which matches .github/renovate.json
but not .github/renovate/*.json. The shared presets that this repo and
undercloud-deploy both extend were therefore never validated locally --
the fileMatch rename in #2212 was skipped by the hook entirely.

Extend the pattern to cover them. All seven presets pass as-is, and
injecting an unknown option into one makes the hook fail as expected.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cardoe
cardoe requested a review from a team August 12, 2026 15:12
@cardoe
cardoe enabled auto-merge August 12, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant