Skip to content

bucketeer-io/bucketeer-code-refs-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Bucketeer Code References GitHub Action

License

This is the official GitHub Action for automatically scanning your repository for Bucketeer feature flag references and sending them to your Bucketeer dashboard.

Installation

Add the following workflow file to your repository at .github/workflows/bucketeer-code-refs.yml:

name: Bucketeer Code References

on:
  push:
    branches:
      - main
      - develop

jobs:
  find-code-references:
    runs-on: ubuntu-latest
    name: Find Bucketeer Code References

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Find Code References
        uses: bucketeer-io/bucketeer-code-refs-action@v2
        with:
          apiKey: ${{ secrets.BUCKETEER_API_KEY }}

Add your Bucketeer API Key to your repository secrets:

  1. Go to your repository's SettingsSecrets and variablesActions
  2. Add a new secret named BUCKETEER_API_KEY with your API Key value

You can create an API Key in your Bucketeer dashboard by clicking the ⚙️ Settings iconAPI KeysNew API Key.

Configuration

Inputs

Input Description Required Default
apiKey Bucketeer API Key with write permissions ✅ Yes -
apiEndpoint Bucketeer API endpoint URI ✅ Yes -
contextLines Number of context lines (0-5, or -1 for no source code) ❌ No 2
debug Enable verbose debug logging ❌ No false
allowTags Allow scanning of tags (lists tags as branches) ❌ No false
ignoreServiceErrors Exit with code 0 when Bucketeer API is unreachable ❌ No false
defaultBranch Default branch name ❌ No main
dir Subdirectory to scan (for monorepos) ❌ No ``
dryRun Run without sending data to Bucketeer ❌ No false

Note: The action scans the branch that triggered the workflow. Configure triggers in the on: section to control which branches are scanned.

How It Works

The action scans your repository for feature flag references by analyzing code patterns such as variation('my-flag'), getBooleanValue('my-flag'), and similar SDK method calls.

Branch Configuration

Important: This action scans only the branch that triggers the workflow.

Scan specific branches

on:
  push:
    branches: [main, develop]  # Only these branches

Scan all branches

on:
  push:
    branches: ['**']  # All branches

Scan pull requests

on:
  pull_request:  # Scan PR head branches

Tip: Use branches: ['**'] for comprehensive coverage, or specify only production branches to reduce noise.

Common Issues

Monorepo: Only Part of Repository Scanned

Use the dir input to specify which subdirectory to scan. Run the action multiple times with different dir values to scan multiple subdirectories.

API Connection Errors Failing CI

Set ignoreServiceErrors: true to prevent CI failures when the Bucketeer API is temporarily unreachable. The action will log the error but exit with code 0.

Contributing

We would ❤️ for you to contribute to Bucketeer and help improve it! Anyone can use and enjoy it!

Please follow our contribution guide at the Bucketeer documentation website.

License

Apache License 2.0, see LICENSE.

Related Projects

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published