-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Project Management Automation: Support adding milestones for fork PRs. #20058
Project Management Automation: Support adding milestones for fork PRs. #20058
Conversation
@@ -25,8 +25,7 @@ const automations = [ | |||
task: ifNotFork( addFirstTimeContributorLabel ), | |||
}, | |||
{ | |||
event: 'pull_request', | |||
action: 'closed', | |||
event: 'push', | |||
task: ifNotFork( addMilestone ), |
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.
Is ifNotFork
necessary anymore?
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.
Yes, why wouldn't it be?
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.
It doesn't seem we would ever have a scenario where we would receive a push
event and also not immediately bail at the first condition checking the master
branch (i.e. I can't see how an error would ever occur if the ifNotFork
was not here). I suppose it might still be better to stop it as early as possible to avoid tying it to this specific implementation.
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.
Forks can also have branches named master
.
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.
Are we receiving push
events for those?
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.
Yes, someone could make a PR from fork/master
.
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.
Hm, ok. I think I may have been expecting that this condition would somehow already be verifying that the commit happened on wordpress/gutenberg
's master
, but I see now that's not the case.
But ifNotFork
was implemented for pull request events, and I think would need to be updated to support this.
gutenberg/packages/project-management-automation/lib/if-not-fork.js
Lines 18 to 19 in cf1a6d0
payload.pull_request.head.repo.full_name === | |
payload.pull_request.base.repo.full_name |
Notably, payload.pull_request
doesn't exist for push
events.
https://developer.github.com/v3/activity/events/types/#pushevent
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.
Then it's better to just not use it. I've removed it. No one actually makes PRs from master
anyway. We can live without milestones for those edge cases.
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.
Then it's better to just not use it. I've removed it. No one actually makes PRs from
master
anyway. We can live without milestones for those edge cases.
I don't know how to search for specific examples to share, but I've definitely seen pulls from forked master
before. That said, the combination of this and a commit message which matches the (#PR)
pattern to get to the point of adding the milestone would be exceedingly rare, yes. And the result would merely be a failing action, nothing too worrisome.
We might want to revisit this in the future to make the logic more durable and to support ifNotFork
usage for non-pull_request
events (especially given the fact the name is generic enough to easily misinterpret that it ought be supported), but I don't think it's a blocker.
Co-Authored-By: Andrew Duthie <andrew@andrewduthie.com>
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.
Small issue with the implementation which causes errors for commits to master: #20144 |
Good catch! Fixed: #20147. |
Follows #20049.