[misc] Add CI check for proto version string changes#5854
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a new GitHub Actions workflow that runs on pull requests touching Changes
Sequence Diagram(s)sequenceDiagram
participant PR as Pull Request
participant Actions as GitHub Actions Runner
participant API as GitHub API
participant Script as actions/github-script
PR->>Actions: pull_request event for `**/*.pb.go`
Actions->>API: list pull request files (paginated, up to 100)
API-->>Actions: file entries (with `patch` fields)
Actions->>Script: filter `.pb.go`, validate patches exist
Script->>Script: scan patch lines for protoc/protoc-gen-go version comments
alt matches found
Script-->>Actions: matched file list + lines
Actions->>Actions: core.setFailed(message with per-file details)
else no matches
Script-->>Actions: "no proto version string changes detected"
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
9ca1d07 to
f714c37
Compare
f714c37 to
f83bed1
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/proto-version-check.yml:
- Around line 23-30: The current filter silently ignores .pb.go files that lack
a patch (pbFiles = files.filter(... && f.patch)), letting changed protobufs
bypass validation; instead, first collect all protobuf candidates (e.g.,
pbCandidates = files.filter(f => f.filename.endsWith('.pb.go'))), detect any
with missing patch data (missing = pbCandidates.filter(f => !f.patch)), and
fail-fast by throwing or returning an error/violation that lists those filenames
before proceeding to use versionPattern and the loop (for (const file of ...))
so the check cannot be skipped due to absent patch content.
- Around line 16-21: The current call to github.rest.pulls.listFiles (assigned
to files) only fetches up to per_page:100 and later filters on f.patch, which
misses files in multi-page PRs and silently ignores files where GitHub omitted
patch data; update the logic to paginate through listFiles results (loop over
pages via page parameter until no more files) and accumulate all file entries,
and change the post-fetch check that inspects f.patch for .pb.go files so that
if a .pb.go file has no f.patch you either mark the file as needing verification
or fail the check (e.g., log a warning and return failure) instead of skipping
it — adjust references around github.rest.pulls.listFiles, the files variable,
and the f.patch filter accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a5f7fb8b-b9a5-4be6-80cd-ddbf1d51f448
📒 Files selected for processing (1)
.github/workflows/proto-version-check.yml
|



Describe your changes
Add a PR-only CI check that fails when a
*.pb.gofile changes theprotocorprotoc-gen-goversion comment. Catches accidental version drift from regenerating with the wrong tool versions. Non-required check, so you can merge anyway when intentionally upgrading.Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__
Summary by CodeRabbit