fix: stash uncommitted changes before gem bump - #286
Open
ronaldtse wants to merge 1 commit into
Open
Conversation
gem bump requires a clean working tree but CI steps like bundle install create untracked files (Gemfile.lock, vendor/bundle, .bundle/config). Previous fix only removed Gemfile.lock but bundle config also writes to vendor/bundle and .bundle/config. Use git stash --include-untracked to hide all uncommitted changes before bumping. This is safe because gem bump commits and pushes its own changes — the stash is only needed to satisfy the clean tree check.
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.
Problem
Follow-up to #285. The
rm -f Gemfile.lockfix was insufficient —bundle installwithbundler-cachealso createsvendor/bundle/and.bundle/configas untracked files, causinggem bumpto still abort.Fix
Use
git stash --include-untrackedinstead of removing a specific file. This temporarily hides ALL uncommitted changes (tracked modifications, untracked files, and gitignored files) beforegem bumpruns.This is safe because:
gem bumpcommits and pushes its own version bump — it does not need the stashed contentgit clean), so generated frontend assets and other build artifacts remain in the stash if needed later in the workflowTesting
Failed with just
rm -f Gemfile.lock: https://github.com/lutaml/moxml/actions/runs/26732999948