Open Source · Apache 2.0

Badgr Agent CI

Failed CI → cause, evidence, fix, confidence.

A pipeline step that explains failures, checks pipeline health, audits config, and flags risky CI patterns. Summary output by default. PR comments optional.

What the output looks like

This is what appears in your Actions summary panel or PR comment when CI fails.

Badgr Agent CI — PR #47 · Run tests · failed
<!-- badgr-agent-diagnosis -->
› Badgr redacted 2 possible secrets before analysis.
### Badgr Agent CI
Likely cause: Missing environment variable DATABASE_URL — connection refused at test step.
Evidence:
  • - Error: connect ECONNREFUSED 127.0.0.1:5432 at step Run tests
  • - Previous successful runs had DATABASE_URL set via repo secrets
  • - Failure appeared immediately after config refactor in commit a3d7f1
Suggested fix: Add DATABASE_URL to repository secrets and reference it in your workflow env: block.
Confidence: highOwner: devops

In summary mode (default) this appears in the Actions panel. Set BADGR_OUTPUT_MODE: pr-comment to post it to the PR instead.

Install

Three lines. No tokens required for default summary output.

.github/workflows/ci.yml
- name: Badgr Agent CI
  if: failure()
  uses: michaelmanly/badgr-agent@v1
  with:
    badgr_api_key: ${{ secrets.BADGR_API_KEY }}
  # Diagnosis → Actions summary panel. No PR write token needed.
  # Opt in to PR comments:
  #   env:
  #     BADGR_OUTPUT_MODE: pr-comment
  #     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Default permissions: contents: read actions: read. Add pull-requests: write only if using pr-comment mode.

Output controls

Set BADGR_OUTPUT_MODE to choose where the diagnosis is delivered.

ValueWhere output goesPR write token?
summary (default)CI summary panel — Actions, Azure, GitLab collapsibleNo
pr-commentPR / MR comment thread (opt-in)Yes
consolestdout onlyNo
bothPR comment + CI summaryYes

Opt in to PR comments

GitHub Actions
env:
  BADGR_OUTPUT_MODE: pr-comment
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Dry-run — inspect payload first

Any platform
env:
  BADGR_DRY_RUN: "1"
# Prints the redacted payload to console.
# No API call is made.

Four modes

Set BADGR_MODE to choose what Badgr analyses. Failure mode is the default. The other three are optional.

failuredefaulttrigger: if: failure()

Diagnoses failed runs: likely cause, evidence, suggested fix, confidence, and responsible team.

Output: summary or PR comment

healthtrigger: if: always() or scheduled

Pipeline performance checks: slowest steps, duration regression, cache misses, flaky tests, retry signals.

Output: summary

audittrigger: on PR open or scheduled

Config improvements: missing caches, no timeouts, overbroad permissions, duplicate jobs, matrix waste.

Output: summary

securitytrigger: scheduled or push to main

Risky CI patterns: token exposure, curl | bash, secrets echoed, overbroad write permissions.

Output: summary or console — never PR comments

Run health check on every pipeline
- name: Badgr Health
  if: always()
  uses: michaelmanly/badgr-agent@v1
  with:
    badgr_api_key: ${{ secrets.BADGR_API_KEY }}
  env:
    BADGR_MODE: health
Weekly config audit (scheduled)
- name: Badgr Audit
  uses: michaelmanly/badgr-agent@v1
  with:
    badgr_api_key: ${{ secrets.BADGR_API_KEY }}
  env:
    BADGR_MODE: audit

Built for security-conscious teams

Every decision in the design was made to reduce token scope, prevent data leakage, and keep CI diagnostics auditable.

🔒

Local redaction before API call

Logs are scanned for 12 secret patterns (JWTs, AWS keys, GitHub/GitLab PATs, Bearer tokens, DB connection strings) and stripped before any network call. The redaction count is printed every run.

🚫

No PR token by default

The default output mode is summary — diagnosis goes to the Actions/pipeline summary panel. No pull-requests: write scope is needed unless you opt in to PR comments.

💬

PR comments are opt-in

Set BADGR_OUTPUT_MODE: pr-comment and provide a token with pull-requests: write. Nothing posts to PR threads unless you ask it to.

🔍

Dry-run shows the payload

Set BADGR_DRY_RUN=1 to see exactly what would be sent to the API — redacted payload printed to console, no API call made. Verify before enabling in production.

🛡️

Security mode never posts to PR

Security scan results always go to summary or console, regardless of BADGR_OUTPUT_MODE. Token exposure findings never appear in pull request threads.

🏠

Bring your own endpoint

Set BADGR_API_URL to route through your own proxy or self-hosted backend. Logs never leave your network. Same env var works across all five adapters.

Self-hosted — logs never leave your network

Any platform
env:
  BADGR_API_KEY: ${{ secrets.BADGR_API_KEY }}
  BADGR_API_URL: https://badgr.internal.yourcompany.com/v1

FAQ

Does it run on every push, or only on failures?
Failure mode runs only when the pipeline fails (if: failure()). Health and audit modes can run on if: always() or a schedule — they produce useful output from any run. Security mode is typically scheduled or triggered on push to main.
What data is sent to Badgr?
A log snippet from the failed step (up to 500 lines / 12KB), after local secret redaction. Repo name, branch, run URL, and PR number are included for context. No source code is ever sent. Set BADGR_DRY_RUN=1 to see the exact payload before enabling.
Can I turn off PR comments for a specific repo?
Yes — the default is already off. Summary mode sends the diagnosis to the CI panel, not the PR thread. Set BADGR_OUTPUT_MODE: summary explicitly if you want to be certain.
Does it update the same comment on re-runs?
Yes. Badgr Agent CI inserts a hidden HTML marker in every comment and finds and updates it on re-runs. One comment per PR, always up to date.
What confidence levels can Badgr return?
low, medium, or high. Even low confidence shows evidence and a suggested fix — it just flags that human review is worthwhile. High confidence means the failure pattern strongly matches a known root cause.
Can I keep logs inside my own network?
Yes. Set BADGR_API_URL to your own endpoint — a self-hosted container or internal proxy. The same environment variable works across all five CI adapters. Self-hosted container image coming soon.
Is Badgr Agent CI open source?
Yes. The agent, all five CI adapters, and the npm package are Apache 2.0. The diagnosis API is a hosted service with BYOK and self-hosted options for enterprise.

Stop hunting through logs.

Add three lines to your workflow. Get cause, evidence, fix, and confidence on every failure.