-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Merged
epiqueras
merged 5 commits into
master
from
add/project-management-automation-milestones-for-fork-prs
Feb 6, 2020
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3a80823
Project Management Automation: Support adding milestones for fork PRs.
epiqueras 81a7d17
Github: Remove unused workflow event.
epiqueras ad855f5
Update packages/project-management-automation/lib/add-milestone.js
epiqueras 4b005c6
Project Management Automation: Update tests.
epiqueras 06d4677
Project Management Automation: Remove `ifNotFork` from milestone hand…
epiqueras File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
on: | ||
pull_request: | ||
types: [opened, closed] | ||
types: [opened] | ||
push: | ||
name: Pull request automation | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 themaster
branch (i.e. I can't see how an error would ever occur if theifNotFork
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
'smaster
, 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
Notably,
payload.pull_request
doesn't exist forpush
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.
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.