Add validate-submodules composite action#103
Merged
Merged
Conversation
Validates submodule references on PRs: 1. The referenced commit is on the upstream branch configured in .gitmodules (falls back to the remote's default branch if not configured) 2. The commit does not regress from the target branch Uses the GitHub API exclusively — no checkout required.
Collaborator
Author
|
This action is very fast: 3s for 3 submodules (see job) |
paulinevos
approved these changes
May 7, 2026
Collaborator
paulinevos
left a comment
There was a problem hiding this comment.
This is a little too much github action foo for me to fully review what's going on, but if it does what it says it does it's a good addition.
GromNaN
commented
May 7, 2026
| pr_sha=$(gh api "repos/$REPO/contents/$path?ref=$PR_SHA" --jq '.sha') | ||
| base_sha=$(gh api "repos/$REPO/contents/$path?ref=$BASE_REF" --jq '.sha' 2>/dev/null || true) | ||
|
|
||
| echo "::group::Checking submodule: $name" |
Collaborator
Author
There was a problem hiding this comment.
This is very useful syntax for rendering collapsable sections.
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.
Submodule updates in a PR are opaque: the diff only shows two commit SHAs with no indication of what changed or whether the update is safe. This action adds two guardrails:
Usage
No
actions/checkoutrequired — the action uses the GitHub API exclusively.The action reads
branchfrom.gitmodulesto know which upstream branch to check against, falling back to the remote's default branch if not configured.Used in mongodb/mongo-php-library#1893