Skip to content
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

Refactor update_pull_requests_milestone to update_assigned_milestone #547

Merged
merged 4 commits into from
Feb 28, 2024

Conversation

AliSoftware
Copy link
Contributor

@AliSoftware AliSoftware commented Feb 26, 2024

What & Why

This updates the update_pull_requests_milestone action so it also includes issues when fetching the list of things to update the milestone of, not just PRs.

Since the action's name and parameters are too related with the "PR" wording, and we already have a breaking change in the CHANGELOG pending to be released (making the next version a major bump anyway), I've decided to use the occasion to rename the action and its parameters to make them more agnostic to the "PR" wording and be more generic:

  • Renamed the action from update_pull_requests_milestone to update_assigned_milestone
  • Renamed the pr_numbers parameter to numbers
  • Renamed the pr_comment parameter to comment

Checklist before requesting a review

  • Run bundle exec rubocop to test for code style violations and recommendations
  • Add Unit Tests (aka specs/*_spec.rb) if applicable
  • Run bundle exec rspec to run the whole test suite and ensure all your tests pass
  • Make sure you added an entry in the CHANGELOG.md file to describe your changes under the appropriate existing ### subsection of the existing ## Trunk section.
  • If applicable, add an entry in the MIGRATION.md file to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.

This is not limited to PRs but should also cover issues
@AliSoftware AliSoftware requested a review from a team February 26, 2024 17:06
@AliSoftware
Copy link
Contributor Author

cc @mokagio FYI as I think you're the only one, besides Tumblr mobile repos, to have started using this action.

@AliSoftware
Copy link
Contributor Author

AliSoftware commented Feb 26, 2024

FYI: Also tested the renamed action with new parameter names manually live (from fastlane run in the command line) with our release-toolkit-demo repo as a guinea pig: Issues 44, 45 & 47, and PR 48

@@ -3,68 +3,68 @@

module Fastlane
module Actions
class UpdatePullRequestsMilestoneAction < Action
class UpdateAssignedMilestoneAction < Action
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again naming 😅
In one hand it is easy to first think "assigned to what?", but at the same time, I think you can only assign a milestone to PRs and issues? In any case, I wonder if being more explicit (e.g. UpdatePullRequestsAndIssuesAssignedMilestoneAction) wouldn't make it clearer.

Copy link
Contributor Author

@AliSoftware AliSoftware Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can only assign a milestone to PRs and issues?

Indeed.

I wonder if being more explicit (e.g. UpdatePullRequestsAndIssuesAssignedMilestoneAction) wouldn't make it clearer

Yeah, but tbh the pull_requests in the original name already felt like a mouthful, so update_pull_requests_and_issues_milestone felt a bit too long as well…

But open to continue brainstorming on ideas if you have other suggestions 👍

Copy link
Contributor

@iangmaia iangmaia Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And thinking a bit more, perhaps Assigned is redundant 🤔

What about:

  • MilestoneUpdaterAction / MilestoneUpdateAction / UpdateMilestoneAction
  • UpdatePullRequestsAndIssuesMilestoneAction
  • UpdateMilestoneForPullRequestsAndIssuesAction
  • MilestoneIssueUpdateAction (considering PRs are also issues, though that might be less obvious at first glance)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Approved the PR; feel free to merge it if you don't feel any of these or another variation improves the current name; I don't feel very strongly about it, but thought we could perhaps find a more fitting one]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I thought about upldate_milestone / milestone_update but the problem with that naming is that it suggests that the action updates the milestone… as in the milestone's own title or due date, etc.
  • The 2nd and 3rd suggestion have the same problem as mentioned in above comment: they're a bit of a mouthful 😓
  • I also thought about using just "issue" in the wording, considering that in the GitHub API parlance, pull requests are also issues (and the search API includes both issues and PRs when using type:issue)… But I felt like this was not obvious enough, especially as in common parlance when we talk about "GitHub Issues" we don't usually mean to include PRs. And as a result, I feel like including "issue" in the action name… might actually have the opposite effect of adding confusion, letting users of the action believe that it would only act on issues but not on PRs…

Boy, naming is hard 😅

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found myself here from a "call for input" on Slack, but I only looked at this specific discussion. Hope my thoughts will prove useful!


I think the original name UpdateAssignedMilestoneAction is good and descriptive.

I agree with @AliSoftware that calling it UpdateMilestoneAction would be interpreted as updating the milestone itself, which means calling this API endpoint that GitHub also titles as Update a milestone.

The current action instead calls the updating issue GitHub endpoint, but it only handles the milestone. Since it's handling a single endpoint and there is really nothing else you can assign a milestone to, I think adding the Assigned is all we need.

Alternative could be UpdateIssueMilestoneAction or UpdateMilestoneForIssueAction, but I don't like these as much.

I also don't think the phrase pull request is necessary to include in the name. In GitHub, pull request is a type of issue, it's not a separate thing. When we do use pull request, I think we should do it because it only handles the pull request type, the same way this specific action only handles the milestone of the issue.

@AliSoftware AliSoftware merged commit 1a9e64a into trunk Feb 28, 2024
5 checks passed
@AliSoftware AliSoftware deleted the include-issues-in-move-milestone branch February 28, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants