From bfbe384280a18eadf33830cff3e14ea887dac57a Mon Sep 17 00:00:00 2001 From: Alexey Alter-Pesotskiy Date: Fri, 8 Mar 2024 14:08:06 +0000 Subject: [PATCH] Get branch --- fastlane/Fastfile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 0795abdb..3ef4eb9e 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -573,7 +573,20 @@ private_lane :create_pr do |options| end private_lane :current_branch do - ENV['BRANCH_NAME'].to_s.empty? ? git_branch : ENV.fetch('BRANCH_NAME') + github_pr_branch_name = ENV['BRANCH_NAME'].to_s + github_ref_branch_name = ENV['GITHUB_REF'].to_s.sub('refs/heads/', '') + fastlane_branch_name = git_branch + + branch_name = if !github_pr_branch_name.empty? + github_pr_branch_name + elsif !fastlane_branch_name.empty? + fastlane_branch_name + elsif !github_ref_branch_name.empty? + github_ref_branch_name + end + + UI.important("Current branch: #{branch_name} 🕊️") + branch_name end private_lane :git_status do |options|