workflows/vendor-gems: fail PRs with out-of-sync vendored gems#22069
Merged
workflows/vendor-gems: fail PRs with out-of-sync vendored gems#22069
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the vendor-gems GitHub Actions workflow to (1) correctly treat Dependabot PRs as auto-updateable and (2) fail CI when the vendored gems/RBIs are not in sync with Gemfile.lock, preventing silent merges with mismatched vendor output.
Changes:
- Fix Dependabot detection by matching
dependabot[bot]inif:conditions and the vendoring script. - Add a final “vendored gems are in sync” check that fails PRs when the working tree differs after running vendoring/typecheck.
Comments suppressed due to low confidence (1)
.github/workflows/vendor-gems.yml:75
- The Vendor Gems step uses
${GITHUB_ACTOR}to decide whether to run with--no-commit. On Dependabot PRs that are re-run by a maintainer,github.event.pull_request.user.loginis stilldependabot[bot](so the later commit/push steps will run) butGITHUB_ACTORwill be the maintainer, so this step will run with--no-commitand leave vendor changes uncommitted—causing the new sync check to fail and preventing the intended auto-push back to the PR. Consider basing this condition on the PR author/login (orgithub.actorin expressions) rather thanGITHUB_ACTORinside the script, e.g. pass a boolean viaenv:and branch on that.
run: |
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" || ("${GITHUB_EVENT_NAME}" == "pull_request" && "${GITHUB_ACTOR}" == "dependabot[bot]") ]]
then
brew vendor-gems --non-bundler-gems
else
brew vendor-gems --non-bundler-gems --no-commit
fi
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Also fix the dependabot conditional: `user.login` is `dependabot[bot]`, not `dependabot`, so the checkout/commit/push steps were silently skipped on dependabot PRs (e.g. #22059 merged with its lockfile ahead of the vendored gems).
2968d80 to
a544ccd
Compare
Bo98
approved these changes
Apr 23, 2026
Member
Bo98
left a comment
There was a problem hiding this comment.
I suspect these auto-pushes won't trigger CI but worth a try.
Not sure about permissions. Might need to do is separate it into an isolated job based on an artifact uploaded here.
Member
Author
|
Will see what happens next time and iterate from there. |
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.
brew lgtm(style, typechecking and tests) with your changes locally?Follow-up to #22065: #22059 merged with its
Gemfile.lockahead of the vendored tree because thevendor-gems.ymlworkflow silently no-oped. Root cause:github.event.pull_request.user.loginisdependabot[bot], notdependabot, so the "Check out pull request", "Commit RBI changes" and "Push to pull request" steps added in aaefb35 have been skipped on every dependabot PR since. Fix the conditional so the workflow again pushes the regenerated vendor tree back, and add a finalgit diff --exit-codestep that fails the check when the vendored tree / RBIs drift fromGemfile.lock— so a repeat of #22059 can't merge even if the auto-push ever fails.Workflow-only change: ran
actionlint .github/workflows/vendor-gems.ymlandbrew style --changed(both clean); skipped the fullbrew lgtmsince there's no Ruby touched. AI (Claude Code) drafted the workflow diff from my description of the bug; I verifieddependabot[bot]was the actualuser.loginagainst the GitHub API for PR #22059 before accepting the fix.