{"id":26063645,"url":"https://github.com/launchdarkly/find-code-references","last_synced_at":"2025-04-06T04:12:43.255Z","repository":{"id":43456022,"uuid":"200282535","full_name":"launchdarkly/find-code-references","owner":"launchdarkly","description":"Find references to feature flags in your code","archived":false,"fork":false,"pushed_at":"2024-12-18T20:53:57.000Z","size":11037,"stargazers_count":58,"open_issues_count":1,"forks_count":16,"subscribers_count":43,"default_branch":"main","last_synced_at":"2025-03-30T03:06:42.636Z","etag":null,"topics":["action","github-action","github-actions","launchdarkly","launchdarkly-docker-image","launchdarkly-integration","managed-by-terraform"],"latest_commit_sha":null,"homepage":"https://docs.launchdarkly.com/home/code/github-actions","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/launchdarkly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-02T18:44:10.000Z","updated_at":"2025-02-28T15:24:39.000Z","dependencies_parsed_at":"2023-10-02T18:16:34.714Z","dependency_job_id":"f0b93b48-1646-4b69-9d9e-40b0a9843262","html_url":"https://github.com/launchdarkly/find-code-references","commit_stats":{"total_commits":44,"total_committers":13,"mean_commits":"3.3846153846153846","dds":0.7954545454545454,"last_synced_commit":"587c699eb3a1ad94abc6f344a34a503e8e6e6d2f"},"previous_names":[],"tags_count":61,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchdarkly%2Ffind-code-references","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchdarkly%2Ffind-code-references/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchdarkly%2Ffind-code-references/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchdarkly%2Ffind-code-references/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/launchdarkly","download_url":"https://codeload.github.com/launchdarkly/find-code-references/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430873,"owners_count":20937874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["action","github-action","github-actions","launchdarkly","launchdarkly-docker-image","launchdarkly-integration","managed-by-terraform"],"created_at":"2025-03-08T17:17:54.254Z","updated_at":"2025-04-06T04:12:43.220Z","avatar_url":"https://github.com/launchdarkly.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LaunchDarkly Code References with GitHub Actions\n\nThis GitHub Action is a utility that automatically populates code references in LaunchDarkly. This is useful for finding references to feature flags in your code, both for reference and for code cleanup.\n\nTo find code references in pull requests, use [launchdarkly/find-code-references-in-pull-request](https://github.com/launchdarkly/find-code-references-in-pull-request) instead.\n\n## Configuration\n\nOnce you've [created a LaunchDarkly access token](https://docs.launchdarkly.com/home/code/github-actions#prerequisites), store the newly created access token as a repository secret titled `LD_ACCESS_TOKEN`. Under Settings \u003e Secrets in your GitHub repo, you'll see a link to \"Add a new secret\".  Click that and paste in your access token and click \"Save secret\".\n\n(For help storing this see the [GitHub docs](https://help.github.com/en/articles/creating-a-github-action).)\n\nNext, create a new Actions workflow in your selected GitHub repository (e.g. `code-references.yml`) in the `.github/workflows` directory of your repository.  Under \"Edit new file\", paste the following code:\n\n```yaml\non: push\nname: Find LaunchDarkly flag code references\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}\n  cancel-in-progress: true\n\njobs:\n  launchDarklyCodeReferences:\n    name: LaunchDarkly Code References\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n      with:\n        fetch-depth: 11 # This value must be set if the lookback configuration option is not disabled for find-code-references. Read more: https://github.com/launchdarkly/ld-find-code-refs#searching-for-unused-flags-extinctions\n    - name: LaunchDarkly Code References\n      uses: launchdarkly/find-code-references@v2.13.0\n      with:\n        accessToken: ${{ secrets.LD_ACCESS_TOKEN }}\n        projKey: LD_PROJECT_KEY\n```\n\nWe strongly recommend that you update the second `uses` attribute value to reference the latest tag in the [launchdarkly/find-code-references repository](https://github.com/launchdarkly/find-code-references). This will pin your workflow to a particular version of the `launchdarkly/find-code-references` action. Also, make sure to change `projKey` to the key of the LaunchDarkly project associated with this repository.\n\nCommit this file under a new branch. Submit as a PR to your code reviewers to be merged into your default branch. You do not need to have this new branch merged into the default branch for code references to appear in the LaunchDarkly UI for your flags. Code references appear for this new branch as soon as it is published.\n\nAs shown in the above example, the workflow should run on the `push` event, and contain an action provided by the [launchdarkly/find-code-references repository](https://github.com/launchdarkly/find-code-references). The `LD_ACCESS_TOKEN` configured in the previous step should be included as a secret, as well as a new environment variable containing your LaunchDarkly project key.\n\n## Additional configuration\n\nTo customize additional configuration not referenced in [Inputs](#inputs), you may use a configuration file located at `.launchdarkly/coderefs.yml`. The following links provide more inforation about configurable options:\n\n- [All configuration options](https://github.com/launchdarkly/ld-find-code-refs/blob/main/docs/CONFIGURATION.md)\n- [Monorepo configuration](https://github.com/launchdarkly/ld-find-code-refs/blob/main/docs/CONFIGURATION.md#projects)\n- [Alias configuration](https://github.com/launchdarkly/ld-find-code-refs/blob/main/docs/ALIASES.md).\n\n## Additional Examples\nThe example below is the same as first, but it also excludes any `dependabot` branches. We suggest excluding any automatically generated branches where flags do not change.\n\n```yaml\non:\n  push:\n    branches-ignore:\n      - 'dependabot/**'\n\nname: Find LaunchDarkly flag code references\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}\n  cancel-in-progress: true\n\njobs:\n  launchDarklyCodeReferences:\n    name: LaunchDarkly Code References\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n      with:\n        fetch-depth: 11 # This value must be set if the lookback configuration option is not disabled for find-code-references. Read more: https://github.com/launchdarkly/ld-find-code-refs#searching-for-unused-flags-extinctions\n    - name: LaunchDarkly Code References\n      uses: launchdarkly/find-code-references@v2.13.0\n      with:\n        accessToken: ${{ secrets.LD_ACCESS_TOKEN }}\n        projKey: LD_PROJECT_KEY\n```\n\n## Troubleshooting\n\nOnce your workflow has been created, the best way to confirm that the workflow is executing correctly is to create a new pull request with the workflow file and verify that the newly created action succeeds.\n\nIf the action fails, there may be a problem with your configuration. To investigate, dig into the action's logs to view any error messages.\n\n\u003c!-- action-docs-inputs source=\"action.yml\" --\u003e\n## Inputs\n\n| name | description | required | default |\n| --- | --- | --- | --- |\n| `accessToken` | \u003cp\u003eA token with write access to the LaunchDarkly project.\u003c/p\u003e | `true` | `\"\"` |\n| `allowTags` | \u003cp\u003eEnable storing references for tags. Lists the tag as a branch.\u003c/p\u003e | `false` | `false` |\n| `baseUri` | \u003cp\u003eThe base URL of the LaunchDarkly server for this configuration.\u003c/p\u003e | `false` | `https://app.launchdarkly.com` |\n| `contextLines` | \u003cp\u003eThe number of context lines above and below a code reference for the job to send to LaunchDarkly. By default, the flag finder will not send any context lines to LaunchDarkly. If \u003c 0, it will send no source code to LaunchDarkly. If 0, it will send only the lines containing flag references. If \u003e 0, it will send that number of context lines above and below the flag reference. You may provide a maximum of 5 context lines.\u003c/p\u003e | `false` | `2` |\n| `debug` | \u003cp\u003eEnable verbose debug logging.\u003c/p\u003e | `false` | `false` |\n| `ignoreServiceErrors` | \u003cp\u003eIf enabled, the scanner will terminate with exit code 0 when the LaunchDarkly API is unreachable or returns an unexpected response.\u003c/p\u003e | `false` | `false` |\n| `lookback` | \u003cp\u003eSet the number of commits to search in history for whether you removed a feature flag from code. You may set to 0 to disable this feature. Setting this option to a high value will increase search time.\u003c/p\u003e | `false` | `10` |\n| `projKey` | \u003cp\u003eKey of the LaunchDarkly project associated with this repository. Found under Account Settings -\u0026gt; Projects in the LaunchDarkly dashboard. Cannot be combined with \u003ccode\u003eprojects\u003c/code\u003e block in configuration file.\u003c/p\u003e | `false` | `\"\"` |\n| `repoName` | \u003cp\u003eThe repository name. Defaults to the current GitHub repository.\u003c/p\u003e | `false` | `\"\"` |\n| `prune` | \u003cp\u003eThere is a known issue where the GitHub Action will not prune deleted branch data in private repos. Only enable this if you are running the action in a public repo.\u003c/p\u003e | `false` | `false` |\n| `subdirectory` | \u003cp\u003eThe subdirectory to run the action in.\u003c/p\u003e | `false` | `\"\"` |\n\u003c!-- action-docs-inputs source=\"action.yml\" --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaunchdarkly%2Ffind-code-references","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaunchdarkly%2Ffind-code-references","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaunchdarkly%2Ffind-code-references/lists"}