From b7c9ced01de44fb177b3a77bffedd8fd4014f137 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 2 Sep 2024 20:07:24 +0200 Subject: [PATCH] Always use origin for checking if the heads point to the same commit --- .../common/create_release_backmerge_pull_request_action.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_backmerge_pull_request_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_backmerge_pull_request_action.rb index afc689132..ab550b27f 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_backmerge_pull_request_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_backmerge_pull_request_action.rb @@ -25,7 +25,7 @@ def self.run(params) github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token]) target_milestone = milestone_title.nil? ? nil : github_helper.get_milestone(repository, milestone_title) - Git.open(Dir.pwd).fetch('origin') + Git.open(Dir.pwd).fetch final_target_branches = if target_branches.empty? unless source_branch.start_with?('release/') @@ -105,7 +105,10 @@ def self.create_backmerge_pr(token:, repository:, title:, head_branch:, base_bra # if there's a callback, make sure it didn't switch branches other_action.ensure_git_branch(branch: "^#{intermediate_branch}/") unless intermediate_branch_created_callback.nil? - if Fastlane::Helper::GitHelper.point_to_same_commit?(base_branch, head_branch) + base_branch_ref = "origin/#{base_branch}" unless base_branch.start_with?('origin/') + head_branch_ref = "origin/#{head_branch}" unless head_branch.start_with?('origin/') + + if Fastlane::Helper::GitHelper.point_to_same_commit?(base_branch_ref, head_branch_ref) UI.error("No differences between #{head_branch} and #{base_branch}. Skipping PR creation.") return nil end