Skip to content

FtrOnOff/ftrio-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

FtrIO Toggle Audit Action

GitHub Action for FtrIO — audit feature toggle state in your .NET codebase, catch MISSING toggles, and verify config before merging.

Part of the FtrIO ecosystem — free, open source feature toggles for .NET.


What it does

Scans your .cs files for every [Toggle], [ToggleAsync], and manual toggle call, cross-references them against your appsettings.json, and reports the state of each toggle: ON, OFF, 20%, BLUE, or MISSING.

A MISSING toggle means the key is referenced in code but has no entry in config — this will throw a ToggleDoesNotExistException at runtime. The action fails the build when any MISSING toggles are found, catching config drift before it reaches production.


Quick start

- uses: FtrOnOff/ftrio-action@v1

Scans the current directory, fails if any MISSING toggles are found.


Inputs

Input Default Description
source . Directory to scan for .cs files
config (source) Directory containing appsettings*.json files
env (all) Target a specific environment overlay (e.g. Staging)
fail-on-missing true Fail the build if any MISSING toggles are found
markdown (none) Path to write a markdown report
version (latest) Pin a specific version of FtrIO.onetwo

Outputs

Output Description
missing-count Number of MISSING toggles found
toggle-count Total number of toggles found
passed true if no MISSING toggles found, false otherwise

Examples

Minimal — fail on missing toggles

steps:
  - uses: actions/checkout@v4

  - uses: FtrOnOff/ftrio-action@v1

Specify source and config directories separately

- uses: FtrOnOff/ftrio-action@v1
  with:
    source: ./src
    config: ./src/MyApp

Target a specific environment

- uses: FtrOnOff/ftrio-action@v1
  with:
    source: ./src
    env: Staging

Warn only — never fail the build

- uses: FtrOnOff/ftrio-action@v1
  with:
    source: ./src
    fail-on-missing: false

Emits GitHub warning annotations on the PR but does not block the merge. Useful when introducing FtrIO to an existing codebase.


Generate a markdown report

- uses: FtrOnOff/ftrio-action@v1
  with:
    source: ./src
    markdown: toggle-report.md

The report is automatically uploaded as a build artifact named ftrio-toggle-report.


Use outputs in later steps

- uses: FtrOnOff/ftrio-action@v1
  id: ftrio

- name: Print summary
  run: |
    echo "Found ${{ steps.ftrio.outputs.toggle-count }} toggles"
    echo "${{ steps.ftrio.outputs.missing-count }} are MISSING"
    echo "Passed: ${{ steps.ftrio.outputs.passed }}"

Pin to a specific FtrIO.onetwo version

- uses: FtrOnOff/ftrio-action@v1
  with:
    version: '1.1.0'

Full CI workflow

name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  build-and-audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-dotnet@v5
        with:
          dotnet-version: '8.0.x'

      - name: Build
        run: dotnet build

      - name: Test
        run: dotnet test

      - name: FtrIO toggle audit
        uses: FtrOnOff/ftrio-action@v1
        with:
          source: ./src
          fail-on-missing: true
          markdown: toggle-report.md

What MISSING looks like in a PR

When MISSING toggles are found the action emits inline GitHub annotations:

Warning: FtrIO: UnknownFeature  ManualCall  MISSING  Controllers\HomeController.cs:42
Error:   FtrIO found 1 MISSING toggle(s). Add the missing keys to appsettings.json
         or remove the [Toggle] attributes.

These appear directly in the PR checks view without needing to open logs.


The FtrIO ecosystem

Tool Purpose
FtrIO Core library. [Toggle] attribute woven into IL at compile time.
FtrIO.Toaster Self-hosted Docker UI for managing toggles live.
FtrIO.onetwo CLI audit tool. This action wraps it.
export-manifest-action Export a manifest of required toggle keys for deployment safety checks.
release-check-action Gate deployments on missing toggle config.

Full docs: ftronoff.github.io/FtrIO

About

GitHub Action for FtrIO — audit feature toggle state, export toggle manifests, and gate deployments on missing config. Wraps FtrIO.onetwo.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors