On this page

Github Code References

Connect Statsig with GitHub to surface code references for feature gates and dynamic configs, so you can see exactly where each flag is used.

Deprecated: PAT-based integration

Statsig has deprecated the Personal Access Token (PAT) based integration in favor of the new GitHub App-based integration. The new integration provides improved security and functionality, including AI-powered features like Knowledge Graph. Migrate to the GitHub AI Integration for the best experience.

How the GitHub integration works

The Statsig GitHub Integration lets you find Feature Gate and Dynamic Config references within your codebase on the Statsig Console. The integration uses the GitHub API to access only Feature Gate or Dynamic Config references and doesn't store any sensitive information.

Configure GitHub code references

Create a new GitHub developer token, either Classic or Fine Grained, with at least read access to the organization or repositories where you use Statsig. Find this in GitHub under Settings > Developer Settings > Personal Access Token.

Then, log in to the Statsig Console and navigate to the GitHub Code References integration on the Integrations page. Find this in Project Settings > Integrations Tab > Github Code References.

The integration provides instructions on how to enable GitHub Code References.

GitHub integration configuration interface

After you enter your token and organization name, Statsig verifies it can access repositories and notifies you of any problems.

Navigate to the Feature Gates or Dynamic Configs pages on the Statsig Console and select a gate or dynamic config. Under the Diagnostics tab, select the View Code References link to see your code references.

Feature gate diagnostics tab showing code references link

Code References appear based on the feature gate or dynamic config page you are on. You can filter Code References by repository and file extension.

Code references panel listing repositories and files

Github code references action

A GitHub Action is also available. It can scan your repositories for gates and dynamic configs, then create a PR replacing Stale Gates.

Was this helpful?