Skip to content

Commit d9ef9c1

Browse files
committed
Cleanup generate_installable_build_number
1 parent fa6c143 commit d9ef9c1

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

fastlane/Fastfile

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -978,22 +978,19 @@ end
978978
# This function is Buildkite-specific
979979
def generate_installable_build_number
980980

981-
# This should work outside of Buildkite
982-
if ENV['BUILDKITE'] != 'true'
983-
require 'git'
981+
if ENV['BUILDKITE']
982+
commit = ENV['BUILDKITE_COMMIT'][0,7]
983+
branch = ENV['BUILDKITE_BRANCH']
984+
pr_num = ENV['BUILDKITE_PULL_REQUEST']
984985

986+
return pr_num == 'false' ? "#{branch}-#{commit}" : "pr#{pr_number}-#{commit}"
987+
else
985988
repo = Git.open(PROJECT_ROOT_FOLDER)
986-
current_branch = repo.current_branch
987-
current_commit = repo.revparse('HEAD')[0, 7]
989+
commit = repo.current_branch
990+
branch = repo.revparse('HEAD')[0, 7]
988991

989-
return "#{current_branch}-#{current_commit}"
992+
return "#{branch}-#{commit}"
990993
end
991-
992-
if ENV['BUILDKITE_PULL_REQUEST'] == 'false'
993-
return "#{ENV['BUILDKITE_BRANCH']}-#{ENV['BUILDKITE_COMMIT'][0,7]}"
994-
end
995-
996-
return "pr#{ENV['BUILDKITE_PULL_REQUEST']}-#{ENV['BUILDKITE_COMMIT'][0,7]}"
997994
end
998995

999996
# Application-agnostic settings for the `upload_to_app_store` action, also

0 commit comments

Comments
 (0)