Skip to content

Commit 0a28f5e

Browse files
committed
Refactor pull_request_number method into a constant
No need to read every time
1 parent b8470b6 commit 0a28f5e

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ steps:
3838
prompt: Share a Prototype Build via Firebase App Distribution?
3939
key: prototype_triggered
4040
- label: Prototype Build
41-
depends: prototype_triggered
41+
depends_on: prototype_triggered
4242
command: .buildkite/commands/prototype-build.sh
4343
plugins: [$CI_TOOLKIT]
4444
notify:

fastlane/Fastfile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ platform :ios do
780780
Branch: `#{ENV.fetch('BUILDKITE_BRANCH', 'N/A')}`
781781
Commit: #{ENV.fetch('BUILDKITE_COMMIT', 'N/A')[0...7]}
782782
NOTES
783-
release_notes += "Pull Request: ##{pull_request_number}" unless pull_request_number.nil?
783+
release_notes += "Pull Request: ##{PULL_REQUEST_NUMBER}" unless PULL_REQUEST_NUMBER.nil?
784784

785785
firebase_app_distribution(
786786
app: FIREBASE_APP_ID,
@@ -796,13 +796,13 @@ platform :ios do
796796
dsym_path: './build/WooCommerce.app.dSYM.zip'
797797
)
798798

799-
next if pull_request_number.nil?
799+
next if PULL_REQUEST_NUMBER.nil?
800800

801801
# PR Comment
802802
comment_body = prototype_build_details_comment(app_display_name: 'WooCommerce iOS Prototype')
803803
comment_on_pr(
804804
project: GITHUB_REPO,
805-
pr_number: pull_request_number,
805+
pr_number: PULL_REQUEST_NUMBER,
806806
reuse_identifier: 'prototype-build-link',
807807
body: comment_body
808808
)
@@ -812,7 +812,7 @@ platform :ios do
812812
lane :build_for_prototype_build do |fetch_code_signing: true|
813813
update_certs_and_profiles_enterprise if fetch_code_signing
814814

815-
pr_prefix = pull_request_number&.then { |num| "pr#{num}" }
815+
pr_prefix = PULL_REQUEST_NUMBER&.then { |num| "pr#{num}" }
816816
commit_short_hash = ENV.fetch('BUILDKITE_COMMIT', '0')[0...7]
817817
build_number = [pr_prefix, commit_short_hash].compact.join('-')
818818

@@ -1526,11 +1526,8 @@ TEST_ANALYTICS_ENVIRONMENT = %w[
15261526
# Release Management Utils
15271527
# -----------------------------------------------------------------------------------
15281528

1529-
def pull_request_number
1530-
# Buildkite sets this env var to the PR number if on a PR, but to 'false' (and not nil) if not on a PR
1531-
pr_num = ENV.fetch('BUILDKITE_PULL_REQUEST', 'false')
1532-
pr_num == 'false' ? nil : Integer(pr_num)
1533-
end
1529+
# Buildkite sets this env var to the PR number if on a PR, but to 'false' (and not nil) if not on a PR
1530+
PULL_REQUEST_NUMBER = ENV['BUILDKITE_PULL_REQUEST']&.then { |n| n == 'false' ? nil : Integer(n) }
15341531

15351532
def create_backmerge_pr
15361533
version = release_version_current

0 commit comments

Comments
 (0)