@@ -74,23 +74,16 @@ def get_last_milestone(repository)
74
74
# Creates a new milestone
75
75
#
76
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 Number of days that a milestone extents
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 :)
86
- # If there is a review process, we want to submit the binary 3 days before its release
87
- #
88
- # Using 3 days is mostly for historical reasons where we release the apps on Monday and submit them on Friday.
89
- days_until_submission = need_submission ? ( number_of_days_from_code_freeze_to_release - 3 ) : newmilestone_duration
90
- submission_date = newmilestone_duedate . to_datetime . next_day ( days_until_submission )
91
- release_date = newmilestone_duedate . to_datetime . next_day ( number_of_days_from_code_freeze_to_release )
77
+ # @param [String] title The name of the milestone we want to create (e.g.: `16.9`)
78
+ # @param [Time] due_date milestone due date (e.g. `2022-10-22T12:00:00Z`)
79
+ # @param [Integer] days_until_submission Number of days until submission
80
+ # @param [Integer] days_until_release Number of days from code freeze to release
81
+ #
82
+ def create_milestone ( repository :, title :, due_date :, days_until_submission :, days_until_release :)
83
+ submission_date = due_date . to_datetime . next_day ( days_until_submission )
84
+ release_date = due_date . to_datetime . next_day ( days_until_release )
92
85
comment = <<~MILESTONE_DESCRIPTION
93
- Code freeze: #{ newmilestone_duedate . to_datetime . strftime ( '%B %d, %Y' ) }
86
+ Code freeze: #{ due_date . to_datetime . strftime ( '%B %d, %Y' ) }
94
87
App Store submission: #{ submission_date . strftime ( '%B %d, %Y' ) }
95
88
Release: #{ release_date . strftime ( '%B %d, %Y' ) }
96
89
MILESTONE_DESCRIPTION
@@ -107,9 +100,9 @@ def create_milestone(repository:, newmilestone_number:, newmilestone_duedate:, n
107
100
#
108
101
# This is a bug in the GitHub API, not in our date computation logic.
109
102
# To solve this, we trick it by forcing the time component of the ISO date we send to be `12:00:00Z`.
110
- options [ :due_on ] = newmilestone_duedate . strftime ( '%Y-%m-%dT12:00:00Z' )
103
+ options [ :due_on ] = due_date . strftime ( '%Y-%m-%dT12:00:00Z' )
111
104
options [ :description ] = comment
112
- client . create_milestone ( repository , newmilestone_number , options )
105
+ client . create_milestone ( repository , title , options )
113
106
end
114
107
115
108
# Creates a Release on GitHub as a Draft
0 commit comments