Add submodule validation workflow#1893
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v2.x #1893 +/- ##
=========================================
Coverage 87.72% 87.72%
Complexity 3328 3328
=========================================
Files 454 454
Lines 6656 6656
=========================================
Hits 5839 5839
Misses 817 817
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Pull request overview
Adds automation to ensure submodule pointers remain valid and non-regressive when updating branches used for releases/maintenance.
Changes:
- Annotates existing submodules in
.gitmoduleswith their intended upstream tracking branches. - Introduces a GitHub Actions workflow to validate submodule references on PRs (and merge queue runs) when submodule pointers/config change.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.gitmodules |
Specifies intended upstream branches for each submodule to support validation logic. |
.github/workflows/submodules.yml |
Adds a workflow that runs a submodule validation action on relevant PR/merge-queue changes. |
| pull_request: | ||
| branches: | ||
| - "v*.*" | ||
| - "feature/*" | ||
| paths: |
Adds a GitHub Actions workflow that validates submodule references on PRs: checks that the referenced commit is on the upstream branch and does not regress from the target branch. Also adds explicit branch tracking to .gitmodules for all submodules.
Move the validation logic into .github/actions/validate-submodules so it can be ported to mongodb-labs/drivers-github-tools. The script now uses the GitHub API exclusively — no checkout required.
|
Interestingly, when the submodule is updated on the target branch, the new action fails because it's behind. Not a big deal because this action is only run when a submodule is updated, and the solution is just to rebase the PR. |
| - name: "Validate submodule commits" | ||
| uses: "mongodb-labs/drivers-github-tools/validate-submodules@v3" | ||
| with: | ||
| token: ${{ github.token }} |
alcaeus
left a comment
There was a problem hiding this comment.
Workflow LGTM. We should consider removing the paths restriction to be able to block pull requests on inconsistent submodules.
| branches: | ||
| - "v*.*" | ||
| - "feature/*" | ||
| paths: |
There was a problem hiding this comment.
Limiting this to paths would prevent us from making this workflow as required.
Validates submodule references on every PR targeting
v*.*orfeature/*branches.Checks
.gitmodules)