Skip to content

Commit 0ae446c

Browse files
justin808claude
andcommitted
Fix release script: Only commit Gemfile.lock if there are staged changes
- Prevents release script failure when release-it doesn't modify Gemfile.lock - Adds check for staged changes before attempting commit - Fixes 'nothing to commit, working tree clean' error during release - Applied RuboCop style corrections (unless/else → if/else) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 09e7f68 commit 0ae446c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rakelib/release.rake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ task :release, %i[gem_version dry_run tools_install] do |_t, args|
7272
# Commit the Gemfile.lock changes made by release-it before gem release
7373
unless is_dry_run
7474
sh_in_dir(gem_root, "git add Gemfile.lock")
75-
sh_in_dir(gem_root, "git commit -m 'Update Gemfile.lock for version #{gem_version}'")
75+
# Only commit if there are staged changes
76+
if `cd #{gem_root} && git diff --cached --quiet; echo $?`.strip == "0"
77+
puts "No Gemfile.lock changes to commit"
78+
else
79+
sh_in_dir(gem_root, "git commit -m 'Update Gemfile.lock for version #{gem_version}'")
80+
end
7681
end
7782

7883
# Release the new gem version

0 commit comments

Comments
 (0)