Assign Code Reviewers
So you want a way to rotate people for code reviews. Currently your team might just be asking channel who's available to do peer review in the development channel whenever a pull request is opened. As you've probably noticed, there's overhead in this. People don't respond or a discussion opens up regarding who's turn it is or who has capacity. You might end up searching recently completed code reviews to determine who should take on the review.
Let's use Pickle to make assigning code reviewers simpler. By the end of this you'll have a simple shortcut your team can use where they just drop in the pull request URL and Pickle will automatically find someone to do it.
Step 1 - Create the Rotation
The first thing we'll do is create a rotation to keep track of who's turn it is for code review. We'll add engineers to the rotation and configure some optional settings. Go to Pickle's App Home and open up Rotations. Create a new rotation and let's start configuring it.
Rotation Name and Members
Rotation Name - Make it something easy to remember; we'll use Code Reviewers.
Pick From - The engineers to be included for code review. Everyone in the selected groups/channels get included whenever you use the rotation, so it might be convenient to just select your
#development-team channel (or similar) if you have one. You can exclude individual users, like if you have a manager or scrum master in
#development-team who shouldn't be getting assigned to code reviews.
Your choices should depend on the flow your team wants, but I'll assume that you don't want to wait too long for code reviews to get picked up. I'll also assume you want to check if someone has capacity before assigning them a review.
Pick Inactive - Since we want to skip away/offline engineers, leave this disabled.
Rotate users with pending picks - Temporarily moves picked users haven't accepted/declined yet to the end of the rotation. Two review requests can come in around the same time, so let's enable it.
Automatically retry a pick when it gets declined - Since the purpose of this rotation is to simplify the process of choosing code reviewers, lets enable it.
Save the rotation.
Your team can now assign code reviewers with
/pickle pull_request_url -r Code Reviewers or with the "Pick someone" form.
This works but it can be improved, because people must still select the Code Review rotation. Wouldn't it be convenient to only specify the pull request URL?
Step 2 - Create a Shortcut
We can make using our rotation easier by adding a shortcut to the
#development-team channel's lightning bolt menu. With it anyone requesting a code review just needs to drop in the Github / Bitbucket / whatever URL. To create this shortcut we'll use Workflows. Access Workflow Builder in the Tools menu under your team's name.
Create Workflow and Trigger
Create a new workflow and select Shortcut as the trigger. In this example we'll set the channel to
#development-team and the short name to Request a code review.
Save the trigger.
Add Form Step
Add Send a form as the first workflow step. This will ask the review requester to specify the pull request link when they invoke our shortcut.
Title - _Request a code review _
Questions - Add a question. Set the question to What's the pull request link? and answer type to Short answer. Mark the question as required.
Send submitted responses to a channel or to someone in a DM: Unchecked
Save the step.
Add Pickle Step
Add Pick someone as the last workflow step. We'll preset the Pickle rotation here.
Post In - Channel where workflow started
Rotation - Code Review
Task - Response to: "What's the pull request link?"
Save the step and publish the workflow. Members of #development-team can now invoke the shortcut to request a code review through the lightning bolt menu. All they have to do is drop in the pull request link and the workflow takes care of the rest.