-
Notifications
You must be signed in to change notification settings - Fork 9
Add named params and yard docs to create_milestone
method at GithubHelper
#426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
66ccfcf
b658f87
10528de
255d108
99a95ac
39b23c8
0750081
b218ccc
de90d4d
d87c03c
7f99d51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -71,15 +71,19 @@ def get_last_milestone(repository) | |||||||||
last_stone | ||||||||||
end | ||||||||||
|
||||||||||
def create_milestone(repository, newmilestone_number, newmilestone_duedate, newmilestone_duration, number_of_days_from_code_freeze_to_release, need_submission) | ||||||||||
# If there is a review process, we want to submit the binary 3 days before its release | ||||||||||
# | ||||||||||
# Using 3 days is mostly for historical reasons where we release the apps on Monday and submit them on Friday. | ||||||||||
days_until_submission = need_submission ? (number_of_days_from_code_freeze_to_release - 3) : newmilestone_duration | ||||||||||
submission_date = newmilestone_duedate.to_datetime.next_day(days_until_submission) | ||||||||||
release_date = newmilestone_duedate.to_datetime.next_day(number_of_days_from_code_freeze_to_release) | ||||||||||
# Creates a new milestone | ||||||||||
# | ||||||||||
# @param [String] repository The repository name, including the organization (e.g. `wordpress-mobile/wordpress-ios`) | ||||||||||
# @param [String] title The name of the milestone we want to create (e.g.: `16.9`) | ||||||||||
# @param [Time] due_date milestone due date (e.g. `2022-10-22T12:00:00Z`) | ||||||||||
# @param [Integer] days_until_submission Number of days until submission | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
# @param [Integer] days_until_release Number of days from code freeze to release | ||||||||||
# | ||||||||||
def create_milestone(repository:, title:, due_date:, days_until_submission:, days_until_release:) | ||||||||||
submission_date = due_date.to_datetime.next_day(days_until_submission) | ||||||||||
release_date = due_date.to_datetime.next_day(days_until_release) | ||||||||||
comment = <<~MILESTONE_DESCRIPTION | ||||||||||
Code freeze: #{newmilestone_duedate.to_datetime.strftime('%B %d, %Y')} | ||||||||||
Code freeze: #{due_date.to_datetime.strftime('%B %d, %Y')} | ||||||||||
App Store submission: #{submission_date.strftime('%B %d, %Y')} | ||||||||||
Release: #{release_date.strftime('%B %d, %Y')} | ||||||||||
MILESTONE_DESCRIPTION | ||||||||||
|
@@ -96,9 +100,9 @@ def create_milestone(repository, newmilestone_number, newmilestone_duedate, newm | |||||||||
# | ||||||||||
# This is a bug in the GitHub API, not in our date computation logic. | ||||||||||
# To solve this, we trick it by forcing the time component of the ISO date we send to be `12:00:00Z`. | ||||||||||
options[:due_on] = newmilestone_duedate.strftime('%Y-%m-%dT12:00:00Z') | ||||||||||
options[:due_on] = due_date.strftime('%Y-%m-%dT12:00:00Z') | ||||||||||
options[:description] = comment | ||||||||||
client.create_milestone(repository, newmilestone_number, options) | ||||||||||
client.create_milestone(repository, title, options) | ||||||||||
end | ||||||||||
|
||||||||||
# Creates a Release on GitHub as a Draft | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,14 +234,14 @@ def get_milestone(milestone_name:) | |
end | ||
|
||
def create_milestone(need_submission:, milestone_duration:, days_code_freeze:) | ||
days_until_submission = need_submission ? (days_code_freeze - 3) : milestone_duration | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this file is focused on testing the helper, and the helper doesn't have knowledge of the concept of Also begs the question what the behavior should do if we provide inconsistent inputs (invalid date, negative values for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's a question that I keep asking myself 🤔 💭 Using as an example a case where I have more days from submission than from release (i.e # Milestone with due_date = '2022-10-20', days_until_submission = 14 and days_until_release = 3
Code freeze: October 20, 2022
App Store submission: November 03, 2022
Release: October 23, 2022 Also, in the cases that we have negative values for these same parameters (i.e # Milestone with due_date = '2022-10-20', days_until_submission = -14 and days_until_release = -14
Code freeze: October 20, 2022
App Store submission: October 06, 2022
Release: October 06, 2022 Also, assuming that when we refer to What is the expected behavior of the dates when creating milestones?
Validating dates is always tricky, I just feel that I should confirm my assumptions before starting anything 😅 I also feel that I should write a mini-P2 to document those changes, just in case anyone passes through here in the future and needs to do any refactorings. 🗒️ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep writing a P2 seems a good idea. As for the cases you mention above, those seems to be good ones; I think we should add those, then use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Every sprint we:
This process is also described in this old blog post, though it might be a tad outdated now. Nowadays some of our apps still have 2-weeks sprints, which means when we do a code freeze on Day D+0 (Monday, start of sprint), we then submit for review on Day D+11 (i.e. second Friday), hope it gets approved over the weekend (it usually is), and release on Day D+14 (next Monday), same day we start a new code freeze. Some other apps use 1-week sprints, which means code freeze at D+0, submission at D+4, release at D+7. |
||
helper = described_class.new(github_token: 'Fake-GitHubToken-123') | ||
helper.create_milestone( | ||
test_repo, | ||
test_milestone_number, | ||
test_milestone_duedate.to_time.utc, | ||
milestone_duration, | ||
days_code_freeze, | ||
need_submission | ||
repository: test_repo, | ||
title: test_milestone_number, | ||
due_date: test_milestone_duedate.to_time.utc, | ||
days_until_submission: days_until_submission, | ||
days_until_release: days_code_freeze | ||
) | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of this rewording?