Skip to content

GitHub Action

Use bagx-action to run bagx in CI without hand-writing workflow steps.

Install

- uses: rsasaki0109/bagx-action@v1

The action is a thin composite wrapper: install bagx from PyPI, then call the CLI.

Benchmark gate

- uses: rsasaki0109/bagx-action@v1
  with:
    suite: benchmarks/my_suite.json
    fail-on: warning

See benchmark for manifest format.

PR readiness diff

On pull requests the action:

  1. Runs bagx eval on the configured bag
  2. Restores a baseline eval JSON from actions/cache (keyed on the PR base SHA)
  3. Runs bagx diff --format markdown and posts a sticky PR comment
  4. Fails when --exit-on severity is reached

Prime the cache on main:

on:
  push:
    branches: [main]

jobs:
  prime:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: rsasaki0109/bagx-action@v1
        with:
          bags: bag/recording.db3
          comment: "false"
      - run: cp .bagx-action/current.json .bagx-action/baseline.json
      - uses: actions/cache/save@v4
        with:
          path: .bagx-action/baseline.json
          key: bagx-eval-baseline-${{ github.sha }}

Static HTML in CI

Combine with bagx eval --html in a custom step, or convert a saved JSON report:

- run: bagx eval bag.db3 --json report.json --html report.html
- uses: actions/upload-artifact@v4
  with:
    name: bagx-report
    path: report.html

Workflow templates

Older copy-paste templates live under examples/github_actions/ in the bagx repo. Prefer bagx-action for new workflows.

Dogfooding

The bagx repository runs bagx-action in .github/workflows/bagx-action-smoke.yml against a synthetic benchmark suite generated by scripts/prepare_ci_benchmark.py.