-
Notifications
You must be signed in to change notification settings - Fork 31
Suggest reviewers action #110
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
Conversation
* | ||
* @author Tobias Nyholm <[email protected]> | ||
*/ | ||
class StdErrIssueApi extends GithubIssueApi |
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 class is never used. But it was really useful when testing/debugging, so I kept it in the PR.
f392c4b
to
3375cc0
Compare
9725a9d
to
c39047f
Compare
This PR is ready for a review |
Tobias, thanks for proposing this feature. I know that some communities have something similar. MY only fear it's whether this will be truly useful to add reviewers ... or it will be just annoying and won't improve the current situation. But, the only way to know it is to try it for real, so I'm 👍 to try this. About the proposed command -> |
Yeah.. I am not sure.. We will see =)
I agree. The only hard requirements at the moment is to write
|
Thank you @stof for the review. I've updated the PR accordingly. |
|
||
on: | ||
repository_dispatch: | ||
types: [find-reviewer] |
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.
Does this mean this workflow is called each time a find-reviewer
webhooks is received? Can you help me understand how this works? thx :)
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.
Exact. Here are some resources about it you could find useful:
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.
The corresponding code was added in a separate PR, which is indeed weird.
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.
So I've defined a special event id called find-reviewer
. In the GithubPullRequestApi::findReviewer()
that @stof linked, I am dispatching this special event.
It is basically me saying: "Hey start the specific CI job called find-reviewer
".
$repository = $event->getRepository(); | ||
|
||
// set scheduled task to run in 20 hours | ||
$this->scheduler->runLater($repository, $data['number'], Task::ACTION_SUGGEST_REVIEWER, new \DateTimeImmutable('+20hours')); |
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.
Ok, so when a new PR is opened, or "ready_for_review", then, 20 hours later, we will run the "suggest reviewer" functionality. 20 hours seems fairly fast to me maybe ?
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 also wonder what to do with PRs opened with the "Status: Needs Work" label for whatever reasons (or changed with Carson bot). But that's probably the same as opening a Draft PR; we don't want it?
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.
the status is set to needs work
when a reviewer asks for changes. Saying we don't want such PRs would be an issue. It means we only accept PRs when they are perfect at first review or when the contributor can change the PR and re-request a review in less than 20 hours after receiving a review (which is putting a lot of burden on them when they contribute in their free time)
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.
@weaverryan Maybe it is too fast, maybe not. Whenever I make a PR I am secretly and eagerly waiting for some kind of feedback. So 20 hours is suuuper long.
@ogizanagi, I've not been thinking of that.. I should make sure the PR has the correct status.
A user may open a PR, then change the status them selves. If so, we should not call for a review.
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 think everyone likes to get a review/comment within a couple hours after opening. However, there is a difference between what we think is reasonable and what we like.
If I think "when does someone start to add a ping or asks on Slack if someone can please take a look at their PR", I think this margin is closer to 5 days - 1 week than to 20 hours.
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.
Should we try with 20 hours for the first 10 pings? Just to see what happens.
Also note that none of us never will be pinged. We will mostly ping symfony contributors that nobody ever pinged directly on github or slack.
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.
FYI: The Rust community has a bot that pings potential reviewers as soon as the PR is open.
https://github.com/rust-lang/rust/pull/78714
$status = $this->statusApi->getIssueStatus($task->getNumber(), $repository); | ||
if (Status::NEEDS_REVIEW === $status || null === $status) { | ||
$this->pullRequestApi->findReviewer($repository, $task->getNumber(), SuggestReviewerCommand::TYPE_SUGGEST); | ||
} else { | ||
// Try again later | ||
$this->scheduler->runLater($repository, $task->getNumber(), Task::ACTION_SUGGEST_REVIEWER, new \DateTimeImmutable('+20hours')); | ||
} |
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.
@ogizanagi I've added this logic.
If the PR does not have status "needs review" we will try again 20 hours later. Just until somebody else has made a comment.
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.
👍 LGTM
4d1db63
to
5ddc389
Compare
private $blocked = [ | ||
'fabpot', 'tobion', 'nicolas-grekas', 'stof', 'dunglas', 'jakzal', | ||
'xabbuh', 'javiereguiluz', 'lyrixx', 'weaverryan', 'chalasr', 'ogizanagi', | ||
'sroze', 'yceruto', 'nyholm', 'wouterj', 'derrabus', 'jderusse', |
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.
does the bot have access to the mergers team?
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.
Im not sure.
But that would be a great future update to implement.
Does any project use this logic successfully already? |
Yes, @javiereguiluz showed some examples from the Ruby community. They have bot that suggest a reviewer when the PR is opened.
Just two very tiny problems.
Yes, Wait and see. Maybe this is a good idea, maybe it is something we disable before Christmas. Let's try something new. |
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.
Let's give it a try :)
5ddc389
to
9a09adf
Compare
493c6fa
to
5daa4d3
Compare
5daa4d3
to
4ba7344
Compare
Let's see how it works! Thanks very much Tobias! |
This PR brings two features:
@carsonbot find me a reviewer please
and a minute later it will reply with a ping to someone.This PR works with a Github action that clones the git-reviewer script, checks out the source (symfony/symfony or symfony/symfony-docs) and then runs the
git-reviewer
. That will produce a group of users that also have modified the changed files in the PR.I ignore FrameworkBundle, all tests and the Changelogs because they are always changed. I also only looking for contributors for the past 2 years.
When the
git-reviewer
is done, we run thebin/console app:review:suggest
command. It looks at the contributor lists, removes people (core team) from a block list and removes all people that already have interacted with the PR.Then it just writes a comment.