blog post banner image

DevCycle releases Code Usages Github action to help keep code clean

Victor Vucicevich


We’re really excited to announce the launch of our newest Github Action, DevCycle Code Usages. With this action, every merge to main now scans for usages of DevCycle variables and feature flags so we can quickly and easily show our users exactly where in their code they can find references to each flag.

Code Cleanup is Hard

We know code cleanup is hard. We deal with it every day, with every new feature we release and every set of flags we need to eventually clean up from our code. Anyone that has used a feature flagging tool for an extended period of time can relate to the challenge there can be in removing flags from code when they’re no longer needed. Firstly, it can be hard just to schedule the time to do it, but when you do take action, there are risks associated with not cleaning up your flags fully and potentially introducing instability to your code.

Given the main purpose of feature flagging is to increase stability and quality while improving efficiency we consider this problem of code cleanup to be extremely important.

Enter DevCycle Code Usages

That’s exactly why we’ve created our Code Usages Github Action. Not only does it automatically scan all merges to prod for new and existing feature flags, but it also pushes that information directly to the DevCycle dashboard. With that information in hand, if you want to know the exact line in all files and repositories where a flag is referenced it’s as easy as checking out the variables section of our interface.

How to Get Started with Code Usages

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

   branches: [main]

   runs-on: ubuntu-latest
   name: Fetch DevCycle Code Usages
     - uses: actions/checkout@v2
         fetch-depth: 0
     - uses: DevCycleHQ/[email protected]
         github-token: ${{ secrets.GITHUB_TOKEN }}
         client-id: ${{ secrets.DVC_CLIENT_ID }}
         client-secret: ${{ secrets.DVC_CLIENT_SECRET }}
         project-key: app-devcycle-com

Your DevCycle API credentials and project token are required to update the DevCycle dashboard.

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



The patterns used to identify references to variables in your code are fully customizable. This action uses the DevCycle CLI under the hood, for details on how to configure the pattern matcher see the CLI configuration.

Get started today for free by adding the Action to your Github repo!

Written By

Victor Vucicevich