feat(autodiscovery/precommit): detect rev version from comment#8402
Merged
olblak merged 9 commits intoApr 26, 2026
Merged
Conversation
Signed-off-by: nickzerjeski <nick@zerjeski.de>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds fallback semver detection for pre-commit repos whose rev is a digest by extracting a semver token from the inline comment, enabling correct versionfilter.pattern generation.
Changes:
- Parse
.pre-commit-config.yamlvia YAML AST to capturerevline comments per repo. - Add fallback logic to extract semver from
revcomments whenrevparsing fails. - Add regression fixture + test scenario for digest
revwith semver comment.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pkg/plugins/autodiscovery/precommit/precommit.go | Captures rev inline comments using YAML AST and stores them on discovered repos. |
| pkg/plugins/autodiscovery/precommit/dependency.go | Extracts semver from rev comments and uses it as a fallback for version filtering. |
| pkg/plugins/autodiscovery/precommit/main_test.go | Adds a scenario covering digest rev with semver in the comment. |
| pkg/plugins/autodiscovery/precommit/testdata/digestcomment/.pre-commit-config.yaml | Adds fixture manifest with digest rev and semver comment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
olblak
approved these changes
Apr 19, 2026
olblak
approved these changes
Apr 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Detect semver versions in pre-commit
revinline comments during autodiscovery.This fixes cases where
revis a frozen digest and the version is stored in a comment, e.g.:Fixes #7740
Changes
.pre-commit-config.yamlas YAML AST and capturerevline comments per repo.revis not semver-compatible,revcomment (e.g.v2.8.0),versionfilter.pattern.testdata/digestcomment) covering digest+comment behavior.Backward Compatibility
revis already semver-compatible.revfails.Validation
go test ./pkg/plugins/autodiscovery/precommit -run 'TestDiscoverManifests'