DEV Community

Cover image for Increase your code reviews productivity with this Github action
Manuel de la Torre
Manuel de la Torre

Posted on

Increase your code reviews productivity with this Github action

As a dev manager I’d always try to improve the performance on my team, and the code reviews are a key step to maintain quality and reduce prevent bugs.

However code reviews usually become a bottleneck due to problems like:

  • People who take a lot of time to review.
  • A few people gets a lot of reviews assigned, while others none.
  • Some just “approve” the pull requests but don’t make a quality review.

The solution

To avoid it I made a Github action that analyzes the latests reviews and prints relevant stats to improve the team’s performance:

Alt Text

  • Average review time: To make each one compare to others and try to be more efficient.
  • # reviewed pull requests: Useful to distribute more evenly the reviews among the team.
  • # of comments: An indicator of who is doing quality review and who doesn’t.

Add to your project

To get this insights, add this Github Action to your project.

Just create a file ./github/workflows/stats.yml and add the following (no need to change anything):

name: Pull Request Stats

on: [push]

jobs:
  stats:
    runs-on: ubuntu-latest
    steps:
      - name: Run pull request stats
        uses: flowwer-dev/pull-request-stats@v1

That’s it! It will run and print the stats in your next Pull Request.

Alt Text

Bonus:

If you prefer more visual stats and add a bit of gamification, pass the option charts and sort the table by your preferred metric:

name: Pull Request Stats

on: [push]

jobs:
  stats:
    runs-on: ubuntu-latest
    steps:
      - name: Run pull request stats
        uses: flowwer-dev/pull-request-stats@v1
        with:
          charts: true
          sort-by: 'COMMENTS'

You’ll end up with stats like this:

Alt Text

The end

Oldest comments (1)

Collapse
 
matthewmcp profile image
Matt McParland

Pretty great stuff, hope to use it in a project one day!