-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a git commit for each selected gem update when --commit
is specified
#53
Conversation
34d31cc
to
ee03852
Compare
ee03852
to
eb3724f
Compare
@@ -28,4 +28,6 @@ jobs: | |||
ruby-version: ${{ matrix.ruby }} | |||
bundler-cache: true | |||
bundler: latest | |||
- run: git config --global user.name 'github-actions[bot]' | |||
- run: git config --global user.email 'github-actions[bot]@users.noreply.github.com' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗒️ The integration tests now need to run actual git commit
commands. In order to create commits, git must be configured with a user name and email.
updates = updater.apply_updates(name) | ||
updated_gem = updates[name] || updates.values.first | ||
next if updated_gem.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗒️ apply_updates
now returns a Hash of the gems that were actually updated. We use this to create a commit message that describes what gem was updated. There are some rare edge cases to consider:
- Nothing was actually updated. This happens when bundler says "Bundler attempted to update [GEM] but its version stayed the same." This is because sometimes gems can't be updated individually and must be updated together. In this case we skip the gem and don't commit.
- More than 1 gem was updated. For example, if we are updating
rails
, several other gems likerailties
, etc. are implicitly updated. For the commit message, we only care about the gem we explicitly asked for;rails
in this case. - Gems other than the one we requested were updated. This is an edge case within edge case (1). Bundler might fail to update the gem we asked for, but still update one of the gem's sub-dependencies. I have seen this happen with
rubocop
andrubocop-ast
. In this case, we will still create a commit; the commit message will contain the actual gem that was updated as opposed to the one we asked for.
@jaredmoody if you have a few minutes, could you review this PR? This will supersede the proof-of-concept (#50, #51) that we discussed previously. |
LGTM, seems more robust than what I wrote :P |
Sometimes, updating gems can lead to bugs or regressions. To facilitate troubleshooting, this PR introduces the ability to commit each selected gem update in its own git commit, complete with a descriptive commit message. You can then make use of tools like
git bisect
to more easily find the update that introduced the problem.To enable this behavior, pass the
--commit
option:The gems you select to be updated will be applied in separate commits, like this:
Supersedes #50 and #51. Closes #49.