Skip to content

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

Merged
merged 1 commit into from
Jan 6, 2021
Merged

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Nov 8, 2020

This PR brings two features:

  1. Someone can make a comment in a PR to say @carsonbot find me a reviewer please and a minute later it will reply with a ping to someone.
  2. If a PR is opened an had no comments/reviews in 24(?) hours, then we write a comment 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 the bin/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.

*
* @author Tobias Nyholm <[email protected]>
*/
class StdErrIssueApi extends GithubIssueApi
Copy link
Member Author

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.

@Nyholm Nyholm force-pushed the suggest-reviewer branch 2 times, most recently from f392c4b to 3375cc0 Compare November 8, 2020 13:25
@Nyholm Nyholm mentioned this pull request Nov 8, 2020
@Nyholm Nyholm force-pushed the suggest-reviewer branch 2 times, most recently from 9725a9d to c39047f Compare November 8, 2020 18:27
@Nyholm
Copy link
Member Author

Nyholm commented Nov 8, 2020

This PR is ready for a review

@javiereguiluz
Copy link
Contributor

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 -> @carsonbot find me a reviewer please These "textual interfaces" are always complex to use ... so maybe we could design it with very simple commands/orders instead of textually correct phrases. E.g. @carsonbot help, @carsonbot find reviewer

@Nyholm
Copy link
Member Author

Nyholm commented Nov 9, 2020

MY only fear it's whether this will be truly useful to add reviewers

Yeah.. I am not sure.. We will see =)

About the proposed command

I agree. The only hard requirements at the moment is to write @carsonbot and review on the same line. So most phrases will be okey.

  • @carsonbot review
  • @carsonbot find reviewer please
  • @carsonbot get a review
  • Please @carsonbot fetch a reviewer for me
  • etc

@Nyholm
Copy link
Member Author

Nyholm commented Nov 10, 2020

Thank you @stof for the review. I've updated the PR accordingly.


on:
repository_dispatch:
types: [find-reviewer]
Copy link
Contributor

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 :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

@stof stof Nov 12, 2020

Choose a reason for hiding this comment

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

Copy link
Member Author

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'));
Copy link
Contributor

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 ?

Copy link
Contributor

@ogizanagi ogizanagi Nov 12, 2020

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?

Copy link
Member

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)

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member Author

@Nyholm Nyholm Nov 12, 2020

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

Comment on lines +46 to +61
$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'));
}
Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 LGTM

@Nyholm Nyholm force-pushed the suggest-reviewer branch 3 times, most recently from 4d1db63 to 5ddc389 Compare November 18, 2020 08:00
private $blocked = [
'fabpot', 'tobion', 'nicolas-grekas', 'stof', 'dunglas', 'jakzal',
'xabbuh', 'javiereguiluz', 'lyrixx', 'weaverryan', 'chalasr', 'ogizanagi',
'sroze', 'yceruto', 'nyholm', 'wouterj', 'derrabus', 'jderusse',
Copy link
Contributor

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?

Copy link
Member Author

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.

@nicolas-grekas
Copy link
Contributor

nicolas-grekas commented Dec 9, 2020

Does any project use this logic successfully already?
I'm curious about how relevant this will be.
Also: which problem does it solve? Will this solve something that is actually slowing us down right now? That's a honest question :) I feel like things are pretty smooth, but I'm curious to see how this proposal can improve things.
What's the way to verify this provides value? Enable, then wait and see?

@Nyholm
Copy link
Member Author

Nyholm commented Dec 9, 2020

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.

which problem does it solve?

Just two very tiny problems.

  1. If a PR dont get any attention, it will try to ping someone
  2. It will ping a person that probably never have been pinged before

What's the way to verify this provides value? Enable, then wait and see?

Yes, Wait and see. Maybe this is a good idea, maybe it is something we disable before Christmas. Let's try something new.

Copy link
Contributor

@nicolas-grekas nicolas-grekas left a 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 :)

@Nyholm Nyholm force-pushed the suggest-reviewer branch 2 times, most recently from 493c6fa to 5daa4d3 Compare January 4, 2021 20:46
@weaverryan
Copy link
Contributor

Let's see how it works! Thanks very much Tobias!

@weaverryan weaverryan merged commit e58dc43 into symfony-tools:master Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

8 participants