Skip to content

Enterprise · Code references

Open removal issues

Once a week the cleanup-issues job turns the cleanup report into one issue per flag, and never opens the same issue twice.

Before you start

  • The scan job of the template runs (GitHub Actions or GitLab CI).
  • The same system client token, with Code references write and Evaluate. It reads the cleanup report too.

What the job does

The job runs:

bash
fluxgate code-refs checklist --out-dir <folder>

The checklist holds the flags of the cleanup report with Remove code, Archived but referenced and Plan removal. Each flag gets a Markdown checklist: one box for each file and line on the default branch, with a link when the repository has a link template, and a last box to archive the flag. For a flag that is already archived, the last box is to delete the flag once a scan finds no references.

For each flag, the job opens an issue titled FluxGate: remove flag <key>. It skips a flag that already has an open issue with exactly that title, and opens at most 10 issues per run.

Turn it on in GitHub

  1. Use the current template, which has the job cleanup-issues (download).
  2. On Settings, Secrets and variables, Actions, Variables, add FLUXGATE_CLEANUP_ISSUES with the value true.
  3. The job runs every Monday at 06:00 UTC. To run it now, open Actions, FluxGate code references, Run workflow.

The job uses the workflow's own GITHUB_TOKEN with the permission issues: write. It needs no checkout.

Turn it on in GitLab

  1. Use the current template, which has the job fluxgate-cleanup-issues (download).
  2. Create a project access token with the api scope and the Reporter role or higher. Add it as the masked CI/CD variable FLUXGATE_GITLAB_ISSUE_TOKEN. The job token of a pipeline cannot create issues.
  3. Open Build, Pipeline schedules, and create a schedule, for example every Monday. Add the variable FLUXGATE_CLEANUP_ISSUES with the value true to the schedule.

Scheduled pipelines run only this job; the scan job skips them.

Optional variables

VariableMeaning
FLUXGATE_CLEANUP_MAX_ISSUESIssues opened per run at most. Default 10

Close an issue

Remove the code, merge, and let the next scan run. Then archive the flag in FluxGate, or delete it if it is already archived, and close the issue. While the issue stays open, the job does not open it again.