Skip to content

fix: stash uncommitted changes before gem bump - #286

Open
ronaldtse wants to merge 1 commit into
metanorma:mainfrom
ronaldtse:fix/stash-before-gem-bump
Open

fix: stash uncommitted changes before gem bump#286
ronaldtse wants to merge 1 commit into
metanorma:mainfrom
ronaldtse:fix/stash-before-gem-bump

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Problem

Follow-up to #285. The rm -f Gemfile.lock fix was insufficient — bundle install with bundler-cache also creates vendor/bundle/ and .bundle/config as untracked files, causing gem bump to still abort.

Fix

Use git stash --include-untracked instead of removing a specific file. This temporarily hides ALL uncommitted changes (tracked modifications, untracked files, and gitignored files) before gem bump runs.

This is safe because:

  • gem bump commits and pushes its own version bump — it does not need the stashed content
  • The stash is temporary and does not affect the pushed commit
  • Does NOT delete any files (unlike git clean), so generated frontend assets and other build artifacts remain in the stash if needed later in the workflow

Testing

Failed with just rm -f Gemfile.lock: https://github.com/lutaml/moxml/actions/runs/26732999948

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.
@opoudjis

opoudjis commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hi @ronaldtse, coming back to this from a queue-tidy — I think this may have been obsoleted by #315 (hardcoded bundler-cache: false, ~2026-06-28), but wanted to sanity-check before suggesting close.

This PR's problem statement: bundle install with bundler-cache creates vendor/bundle/ and .bundle/config as untracked files, blocking gem bump.

Post-#315 state on main:

  • Both preflight and release jobs now hardcode bundler-cache: false (rubygems-release.yml:117, :207).
  • Without bundler-cache, ruby/setup-ruby doesn't populate vendor/bundle/, and the explicit bundle install steps use system gems (no --path). vendor/bundle/ is no longer created.
  • .bundle/config is still created by bundle config set --local without 'test' at line 223 — but this happens AFTER rm -f Gemfile.lock (line 219) and BEFORE gem bump (line 238); gem bump's git ops (git commit -am, git tag, git push) don't operate on untracked files, so it shouldn't block.
  • The skip_gemfile_lock input's [DEPRECATED — IGNORED as of 2026-06-28 (see #314)] docblock literally records that rubygems-release: hardcode bundler-cache: false to stop stale-restore silent missing-gem #315 was the fix for this interaction.

Reads to me as obsoleted. Suggest close, unless you want git stash --include-untracked for defense-in-depth (e.g., in case bundler-cache: true is ever re-enabled or a post_install hook creates other untracked files) — happy to help refactor if so.

🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants