blog post banner image

Code Review Is Hard, but Github Actions Make them Easier

Victor Vucicevich


Suppose your development and release process is anything like ours at DevCycle. In that case, you likely rely heavily on a solid yet efficient pull request (PR) code review process to keep the drumbeat going in your continuous deployment process.

A code review process is great, but it often relies too heavily on how people comment on their code to make reviews quick and easy. This means that depending on who’s submitting the PR, the level of detail can vary wildly, making it hard to standardize the review process.

You likely leverage several Github Actions to add further details to PRs or ensure your PRs have the correct information.

You’ve also likely brought feature flagging into your workflow at some point in your team's growth, as it helps to support a continuous deployment process. Still, it also adds another level of complexity to the code that is being shipped. Anyone submitting code for review needs to ensure they are not only providing details relating to the code but also relating to the functionality of flags they’ve added, changed, or removed.

Introducing DevCycle’s Pull Request Insights Github Action

For our team at DevCycle, it was a no-brainer for us to create a Github Action to improve the code review process. We rely on Github Actions a lot internally, we leverage a ton of feature flags in our code, and we’re always looking for ways to improve our engineering processes.

What does the Github Action do?

  1. DevCycle’s Pull Request Github Action scans the code in a PR to see if any feature flag variables have been added, changed, or removed
  2. Add a comment to the PR highlighting which variables changed and what the change was

It’s that simple. This little bit of extra information in every PR makes managing feature flags as part of the code review process much more manageable.

Using it In Your Workflow

To get started using the Github Action in your workflow, you need to add the Github Action to any project you’re currently using DevCycle feature flags in. You can find the action here.

Create a new Actions workflow in your GitHub repository (e.g., devcycle-insights.yml) in the .github/workflows directory. In your new file, paste the following code:

on: pull_request

   runs-on: ubuntu-latest
   name: Generate DevCycle PR Insights
     - uses: actions/checkout@v2
         fetch-depth: 0
     - uses: DevCycleHQ/[email protected]
         # Token generated by GitHub
         github-token: ${{ secrets.GITHUB_TOKEN }}
         # Your DevCycle project key
         project-key: your-project-key
         # Your organization's DevCycle API client ID & secret
         client-id: ${{ secrets.DVC_CLIENT_ID }}
         client-secret: ${{ secrets.DVC_CLIENT_SECRET }}

We recommend including your DevCycle API credentials and project token as inputs. If included, the PR comment will be enriched with Feature Flag data from DevCycle.

When referencing your API client ID and secret, we recommend using GitHub Secrets to store your credentials securely.



Now not every team works the same way and we’ve found that a lot of teams like to use different naming structures in their code than our variable keys. So for those teams that like an extra bit of customization you can easily provide a list of aliases to the action to map your code variables to their DevCycle variable keys. This action uses the DevCycle CLI under the hood, for details on how to configure the pattern matcher see the CLI configuration.

We’re really excited about this functionality and addition to our internal processes. If you want help improving your code review processes with our Github Action let us know.

Written By

Victor Vucicevich