Skip to main content

GitHub Action

This section describes how to use ConfigCat's GitHub Action to scan your source code for feature flag and setting usages and upload the found code references to ConfigCat.

Configuration

  1. Create a new ConfigCat Management API credential and store its values in your repository's GitHub Secrets with the following names: CONFIGCAT_API_USER, CONFIGCAT_API_PASS.

  2. Get your selected Config's ID.

  3. Create a new Actions workflow in your GitHub repository under the .github/workflows folder, and put the following snippet into it. Don't forget to replace the PASTE-YOUR-CONFIG-ID-HERE value with your actual Config ID.

    on: [push]
    name: Code references
    jobs:
    scan-repo:
    runs-on: ubuntu-latest
    name: Scan repository for code references
    steps:
    - name: Checkout
    uses: actions/[email protected]
    - name: Scan & upload
    uses: configcat/scan-[email protected]
    with:
    api-user: ${{ secrets.CONFIGCAT_API_USER }}
    api-pass: ${{ secrets.CONFIGCAT_API_PASS }}
    config-id: PASTE-YOUR-CONFIG-ID-HERE
  4. Commit & push your action.

The above example configures a workflow that executes the scan and code references upload on every git push event. Scan reports are uploaded for each branch of your repository that triggers the workflow.

Available Options

ParameterDescriptionRequiredDefault
config-idID of the ConfigCat config to scan against.โ˜‘
api-userConfigCat Management API basic authentication username.โ˜‘
api-passConfigCat Management API basic authentication password.โ˜‘
api-hostConfigCat Management API host.api.configcat.com
line-countContext line count before and after the reference line. (min: 1, max: 10)4
sub-folderSub-folder to scan, relative to the repository root folder.
verboseTurns on detailed logging.false