-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix Backmerge PR action #587
Conversation
Generated by 🚫 Danger |
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.
Would be worth testing this in real world in a dummy repo (maybe release-toolkit-demo
, which was created a while ago mostly for such testing purposes…?), e.g. creating a release/12.4
branch and a release/12.3
branch then running that action with source_branch:'release/12.3'
and no target_branches
)
b7c9ced
to
332e9f8
Compare
I've ran some tests, and unfortunately, fetching |
ref1_commit = git_repo.gcommit(ref1) | ||
ref2_commit = git_repo.gcommit(ref2) | ||
rescue StandardError => e | ||
puts "Error: #{e.message}" |
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.
What do you think of:
puts "Error: #{e.message}" | |
UI.error "Error fetching commits for #{ref1} and #{ref2}: #{e.message}" |
Actually, those are two different suggestions:
- Use
UI.error
instead ofputs
- Include the attempted operation in the error message
@@ -39,7 +39,7 @@ def stub_expected_pull_requests(expected_backmerge_branches:, source_branch:, la | |||
|
|||
next if branch_exists_on_remote | |||
|
|||
allow(Fastlane::Helper::GitHelper).to receive(:point_to_same_commit?).with(target_branch, source_branch).and_return(point_to_same_commit) | |||
allow(Fastlane::Helper::GitHelper).to receive(:point_to_same_commit?).with("origin/#{target_branch}", "origin/#{source_branch}").and_return(point_to_same_commit) |
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.
Unrelated to this particular line, but I wonder if it would be worth adding a test to ensure that if we pass branches that already have "origin/" in the name, our logic doesn't append an additional "origin/" to them.
What does it do?
We have noticed the error below while creating a backmerge to a hotfix branch:
Meaning that the given branch
release/<HOTFIX VERSION>
isn't present locally and only inorigin
. From inspecting the code and logs, this error most likely happened in the methodGitHelper.point_to_same_commit?
, called in the line 106 of the actioncreate_release_backmerge_pull_request_action
.This PRs uses
origin/
to compare the refs and some safety net topoint_to_same_commit?
.Checklist before requesting a review
bundle exec rubocop
to test for code style violations and recommendationsspecs/*_spec.rb
) if applicablebundle exec rspec
to run the whole test suite and ensure all your tests passCHANGELOG.md
file to describe your changes under the appropriate existing###
subsection of the existing## Trunk
section.MIGRATION.md
file to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.