DEV Community

Cover image for Show appreciation for your team’s code with Bonusly for GitHub
Jody Heavener
Jody Heavener

Posted on

Show appreciation for your team’s code with Bonusly for GitHub

Have you heard of Bonusly? If not, you’re missing out. It’s a tool “dedicated to building recognition-rich cultures in workplaces across the globe”. One of the core concepts of the tool is to award your teammates with “points”. This could be for a job well done, a birthday, a work anniversary, anything you can think of. These points can then be redeemed for physical and digital goods, gift cards, donations to charity, and more.

I’ve long been a fan, and thought there must be a way to combine Bonusly’s recognition point system with the hard work developers do. That’s why I’m happy to present my submission to the GitHub Actions x DEV Hackathon: Bonusly for GitHub.

My Workflow

You can find and install the Bonusly for GitHub Action from the GitHub Marketplace.

Follow the README Usage instructions to get started, including prerequisites for secrets. An example workflow might look something like this:

name: Bonusly

on:
  pull_request:
    types: [closed]

jobs:
  merge-allocate:
    runs-on: ubuntu-latest
    name: Merge allocate
    steps:
      - uses: actions/checkout@v2
      - uses: jodyheavener/bonusly-github@0.1.0
        if: github.event.pull_request.merged
        with:
          bonusly-token: ${{ secrets.BONUSLY_API_TOKEN }}
          github-token: ${{ secrets.GH_API_TOKEN }}
          default-hashtag: '#awesome'
Enter fullscreen mode Exit fullscreen mode

You’ll notice that this runs only on Pull Request closure, and is further narrowed by the if statement under “steps” to indicate we only want to act on merged Pull Requests.

Once you’re up and running, all that’s left to do is to start awarding points to your co-workers via comments on their PRs! Check out the repo README for supported comment formats, as well as some gotchas that may occur.

Example of a pull request with a Bonusly comment

Once the Pull Request is merged the Action will run and allocate any Bonusly points to the commit authors of the PR. This even works for co-authored commits!

Example of a merged pull request with Bonusly points awarded

Done! Points awarded and teammates celebrated for their hard work. 🥂

Preview of Bonusly dashboard displaying awarded points

Submission Category:

Wacky Wildcards

I might even say Maintainer Must-Haves as well, depending on how your team is set up.

Yaml File or Link to Code

GitHub logo jodyheavener / bonusly-github

A GitHub Action for Bonusly

Bonusly for GitHub

Award Bonusly points for successful Pull Request merges.

Usage

First, set the following secrets on your repo:

# A Bonusly API Access Token
# https://bonus.ly/api
BONUSLY_API_TOKEN
# A GitHub Personal Access Token
# https://github.com/settings/tokens/new
GH_API_TOKEN
Enter fullscreen mode Exit fullscreen mode

Then set up a new workflow:

name: Bonusly

on:
  pull_request:
    types: [closed]

jobs:
  merge-allocate:
    runs-on: ubuntu-latest
    name: Merge allocate
    steps:
      - uses: actions/checkout@v2
      - uses: jodyheavener/bonusly-github@0.1.0
        if: github.event.pull_request.merged
        with:
          bonusly-token: ${{ secrets.BONUSLY_API_TOKEN }}
          github-token: ${{ secrets.GH_API_TOKEN }}
          default-hashtag: '#awesome'
Enter fullscreen mode Exit fullscreen mode

Now, anyone who would like to award the commit authors of a merged Pull Request can indicate so by leaving a comment on it in one of the following formats:

@bonusly +[amount] [message]
@bonusly [amount] [message]
@bonusly [amount] points [message]

When the Pull Request is merged the points will be awarded and a comment will…

Additional Resources / Info

GitHub Actions are a lot of fun. I actually went through a whole lot of ideas before landing on this one. It was totally worth it because Bonusly is a pretty powerful tool for bringing teams together, especially these days when a lot of folks might not be connecting with their teammates as much as they’d like.

Hope you liked this submission. All thoughts and feedback welcome.

Top comments (0)