-
Notifications
You must be signed in to change notification settings - Fork 67
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
Fix #217: Removes PR from Blocking Bugs Milestone #249
Conversation
@jameesjohn @vojtechjelinek PTAL. I just want to get the confirmation that the method which I have adopted to remove milestone from PR looks good or not and then I will try to work on the failure of frontend tests. |
The approach looks correct. |
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.
Thanks, @SAEb-ai!
I took the first pass.
lib/checkPullRequestLabels.js
Outdated
@@ -31,8 +31,10 @@ const { | |||
oppiaDevWorkflowTeam, | |||
serverJobAdmins, | |||
} = require('../userWhitelist.json'); | |||
const { Octokit } = require('probot'); |
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 this required?
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.
Removed
index.js
Outdated
case constants.prMilestoneCheck: | ||
callable.push( | ||
checkPullRequestLabelsModule.checkForMilestone(context) | ||
) |
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.
) | |
); | |
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.
Done
@@ -143,6 +144,7 @@ module.exports.issuesLabelCheck = issuesLabelCheck; | |||
module.exports.issuesAssignedCheck = issuesAssignedCheck; | |||
module.exports.datastoreLabelCheck = datastoreLabelCheck; | |||
module.exports.prLabelCheck = prLabelCheck; | |||
module.exports.prMilestoneCheck = prMilestoneCheck; |
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.
You should probably add the milestoned
event and specify that the prMilestoneCheck
be run.
See how other events like the openEvent
were done.
Lines 71 to 74 in ec404f4
'oppia': { | |
[openEvent]: [ | |
claCheck, | |
changelogCheck, |
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.
Done
@@ -110,6 +110,11 @@ const runChecks = async (context, checkEvent) => { | |||
checkPullRequestLabelsModule.checkForIssueLabel(context) |
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.
Since this feature listens for a new event, there should be an entry where oppiabot listens for the event. Similar to
Lines 237 to 241 in ec404f4
oppiabot.on('pull_request.labeled', async (context) => { | |
if (checkWhitelistedAccounts(context) && checkAuthor(context)) { | |
await runChecks(context, constants.PRLabelEvent); | |
} | |
}); |
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.
Done
lib/checkPullRequestLabels.js
Outdated
const commentBody = | ||
'Hi @' + user.login + ', the ' + milestone.title + | ||
' milestone should only be ' + | ||
'used on issues, and Im removing the milestone. Thanks!'; |
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.
'used on issues, and Im removing the milestone. Thanks!'; | |
'used on issues, and I'm removing the milestone. Thanks!'; |
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.
Done
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.
Thanks! Left two comments.
lib/checkPullRequestLabels.js
Outdated
@@ -33,6 +33,7 @@ const { | |||
} = require('../userWhitelist.json'); | |||
const DEFAULT_CHANGELOG_LABEL = 'REVIEWERS: Please add changelog label'; | |||
const PR_LABELS = ['dependencies', 'stale', DEFAULT_CHANGELOG_LABEL]; | |||
const MILESTONES = ['Blocking Bugs']; |
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.
Can we get the milestones from GitHub? If not this should be probably added as a constant in constants.js.
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.
Added it in constants.js. Done!
lib/checkPullRequestLabels.js
Outdated
const commentBody = | ||
'Hi @' + user.login + ', the ' + milestone.title + | ||
' milestone should only be ' + | ||
'used on issues, and I’m removing the milestone. Thanks!'; |
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.
'used on issues, and I’m removing the milestone. Thanks!'; | |
'used for issues. I’m removing the milestone from this PR. Thanks!'; |
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.
Done
@vojtechjelinek @jameesjohn @gp201 PTAL.Thanks! |
const milestones = ['Regressions (August 2021)', | ||
'Hotlist (August 2021)', | ||
'Py3 Migration QA (June 2021)']; |
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.
@jameesjohn Can we extract the milestones of a repository from github API because this doesn't look to be an optimal solution?
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.
* This function checks that a milestone has not been added to a | ||
* Pull Request. |
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.
* This function checks that a milestone has not been added to a | |
* Pull Request. | |
* This function ensures that a milestone has not been added to a | |
* Pull Request. |
@@ -464,6 +465,42 @@ describe('Pull Request Label Check', () => { | |||
}); | |||
}); | |||
|
|||
describe('when a pr is milestoned', () => { |
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.
Can you also write a test to make sure nothing happens when a milestone is not added?
const milestones = ['Regressions (August 2021)', | ||
'Hotlist (August 2021)', | ||
'Py3 Migration QA (June 2021)']; |
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.
Unassigning @gp201 since the review is done. |
Explanation
Fixes #217. It removes PR from Blocking Bugs Milestone
Checklist