Skip to content

Commit 66ccfcf

Browse files
committed
GithubHelperSpec: Add Yard Docs and Named Parameters to create_milestone method
To become this method cleaner and more legible to call, we're adding named parameters to it, following the name of the current ones, and also adding yard docs to help guide the new people who use it
1 parent 15c5b99 commit 66ccfcf

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,18 @@ def get_last_milestone(repository)
7171
last_stone
7272
end
7373

74-
def create_milestone(repository, newmilestone_number, newmilestone_duedate, newmilestone_duration, number_of_days_from_code_freeze_to_release, need_submission)
74+
# Creates a new milestone
75+
#
76+
# @param [String] repository The repository name, including the organization (e.g. `wordpress-mobile/wordpress-ios`)
77+
# @param [String] newmilestone_number The name of the milestone we want to create (e.g.: `16.9`)
78+
# @param [Time] newmilestone_duedate milestone due date (e.g. `2022-10-22T12:00:00Z`)
79+
# @param [Integer] newmilestone_duration Milestone duration in number of days
80+
# @param [Integer] number_of_days_from_code_freeze_to_release Number of days from code freeze to release
81+
# @param [Boolean] need_submission The app needs to be submitted?
82+
# if `true`, will subtract 3 days from the `:number_of_days_from_code_freeze_to_release`.
83+
# if `false`, will use the days of `:newmilestone_duration`
84+
#
85+
def create_milestone(repository:, newmilestone_number:, newmilestone_duedate:, newmilestone_duration:, number_of_days_from_code_freeze_to_release:, need_submission:)
7586
# If there is a review process, we want to submit the binary 3 days before its release
7687
#
7788
# Using 3 days is mostly for historical reasons where we release the apps on Monday and submit them on Friday.

spec/github_helper_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,12 @@ def get_milestone(milestone_name:)
236236
def create_milestone(need_submission:, milestone_duration:, days_code_freeze:)
237237
helper = described_class.new(github_token: 'Fake-GitHubToken-123')
238238
helper.create_milestone(
239-
test_repo,
240-
test_milestone_number,
241-
test_milestone_duedate.to_time.utc,
242-
milestone_duration,
243-
days_code_freeze,
244-
need_submission
239+
repository: test_repo,
240+
newmilestone_number: test_milestone_number,
241+
newmilestone_duedate: test_milestone_duedate.to_time.utc,
242+
newmilestone_duration: milestone_duration,
243+
number_of_days_from_code_freeze_to_release: days_code_freeze,
244+
need_submission: need_submission
245245
)
246246
end
247247
end

0 commit comments

Comments
 (0)