DEV Community

Masato Ohba
Masato Ohba

Posted on • Updated on

Show pull requests awaiting review on Slack periodically

Is your team's review process successful? Does your team have a stagnant review and the team's atmosphere is getting worse?

Here is a tip to periodically notify Slack of pull request list awaiting review.

Nutshell

Let's use review-waiting-list-bot to make your team's review process smooth and fun!

What is it like?

Every morning at 11:00 am JST on my team's Slack channel bot will notify me of team members' pending review list.

Each pull request corresponds to each post. Then developers make expressions like "I'm in review 👀" "merged! ✅" with emoji for each and ask questions synchronously in threads. What an engineer-like behavior!

It is not tasteful when referring private repositories (and it is full of mosaics because it is business information). But for public repositories, Slack automatically expands pull requests, so it looks more fabulous.

How does it work?

In short,

  • A Slack bot named review-waiting-list-bot is deployed in Heroku (even in free dyno, since the worker process works without sleeping, it always reacts to the mentions)
  • When it receives a mention, it queries GitHub API and gathers pull requests, then posts them to Slack
  • Slack's reminder periodically calls this bot

review-waiting-list-bot

https://github.com/ohbarye/review-waiting-list-bot

Slack bot made by Node.js, it uses Botkit as a framework.

I wanted to try async / await so I made it with Node 8. Unfortunately, Botkit is not compatible with Promise and it compels a developer to write so many callbacks. https://github.com/howdyai/botkit/pull/278 was attempting to resolve the issue, but after a long abandonment, the author's heart seems to have broken. Anyway, where to call GitHub 's API in the bot is well organized with async / await.

You can specify author,owner, repo when calling the bot. Exclusion condition (exclusive) is also available with a notation like -repo. For details, see README#Usage.

Slack Reminder

I could also create a mechanism to post regularly on the bot side, but I did not do it. If I did it, the bot would need to have some settings for that (it means that the bot would get stateless!). Besides, a team familiar with Slack must be able to use the reminder function provided by Slack fully.

By the way, when reminding every morning at 11 o'clock, the command to set up is like below. Note that the time zone depends on a reminder creator's setting.

/remind #channel-name "@review-bot ls author:org/my-team owner:org -repo:design" every weekday at 11am

For details on reminders, see https://get.slack.help/hc/en-us/articles/208423427-Set-a-reminde.

How my team reacted?

After I introduced at the meeting among developers, several teams in my company seem to be using it. Some groups call Slack on a regular basis, and others call it manually at the end of their daily meeting to synchronize their progress.

I praised not only activities of a team but also individual OSS activities.

Impression

It was surprising that not only developers but also product managers are pleased the bot. They say, it helps to grasp the progress of development.

If you are a developer and has a user of their product in their company, you can receive feedback immediately. That's absolutely a developer's delight, right?

Discussion (0)