GitHub Integration

Integrate BugBrain with GitHub to automatically create issues from test failures and add test results to pull requests.

Features

  • Auto-create issues on test failures with error details and screenshots
  • PR checks — Add test execution status to pull requests
  • Issue deduplication — Avoid duplicate issues for same bug
  • Label mapping — Automatically tag issues by severity
  • Close on fix — Auto-close issues when tests pass
  • Workflow integration — Run BugBrain tests in GitHub Actions

Setup

1
Install GitHub App
Go to BugBrain Settings → Integrations → GitHub → Install App
2
Select Repositories
Choose which repositories can receive issues from BugBrain
3
Configure Issue Rules
Set failure severity thresholds and label mappings
4
Test Integration
Run a test that fails to create a sample issue

Configuration

Issue Creation Rules

SettingOptionsDefault
Create issues forAll failures / Critical only / NeverAll failures
Severity → LabelMap each severity to GitHub labelHigh → “bug”, Low → “test-failure”
Auto-close on fixYes / NoYes
Issue templateDefault / CustomDefault

Example Configuration

{
  "create_for_severity": "critical",
  "severity_labels": {
    "critical": "🔴 critical",
    "high": "🟠 high-priority",
    "medium": "🟡 medium",
    "low": "🟢 low"
  },
  "assignees": ["@qa-team"],
  "auto_close": true,
  "deduplication_window_hours": 24
}

Issue Format

Example GitHub Issue Created:

Title: [BugBrain] Add to Cart button not clickable

Body:
🤖 **Automated Issue from BugBrain**

**Test:** Product Checkout Flow
**Failure:** Element not found: .add-to-cart-btn
**Severity:** 🔴 Critical

**Error Details:**
- Expected selector: `.add-to-cart-btn`
- Suggested fix: Update to `.product-add-btn`
- Confidence: 95%

**Steps to Reproduce:**
1. Navigate to /products
2. Select first product
3. Click "Add to Cart"

[View Full Execution Report](https://app.bugbrain.tech/executions/exec_abc123)

**Screenshots:**
[failure.png]

---
*Reported by BugBrain at 2025-03-08 10:30 UTC*

PR Checks

Add BugBrain test results to pull requests:

  1. SettingsIntegrationsGitHubEnable PR Checks
  2. Tests automatically run on PR creation/push
  3. Status badge shows pass/fail
  4. Click to see detailed results

PR Check Display:

✅ BugBrain Tests / Smoke Tests
🟡 BugBrain Tests / Full Test Suite (in progress)
🔴 BugBrain Tests / Security Tests (2 failures)

Deduplication

Prevent duplicate issues for the same failure:

  • Window: 24 hours (default, configurable)
  • Matching: Same test + same error message
  • Action: Updates existing issue instead of creating new one
  • Comment: Adds “Failure still occurring” comment with new timestamp

Auto-Close

When a previously failing test passes:

  1. BugBrain detects test is now passing
  2. Finds original GitHub issue (linked via comment)
  3. Adds comment: ”✅ Fixed in commit [hash] on [branch]”
  4. Closes issue
  5. Posts to Slack/Teams (if configured)

Disable auto-close: Settings → Integrations → GitHub → Uncheck “Auto-close fixed issues”

Example: Workflow File

Create .github/workflows/bugbrain-tests.yml:

name: BugBrain Tests
on:
  pull_request:
  push:
    branches: [main, develop]
 
jobs:
  bugbrain:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
 
      - name: Run BugBrain Tests
        uses: bugbrain/test-action@v1
        with:
          api_key: ${{ secrets.BUGBRAIN_API_KEY }}
          test_plan_id: tp_prod_xyz
          project_id: proj_abc123
          create_github_issues: true

Troubleshooting

Issues Not Creating

  • Verify: App has issue write permissions
  • Check: Failure severity meets threshold
  • Confirm: Repository selected in GitHub App settings
  • Look: BugBrain logs → Integrations → GitHub delivery logs

Issues Creating Duplicates

  • Increase deduplication window (Settings → Integrations)
  • Or disable deduplication for very flaky tests

PR Checks Not Showing

  • Ensure GitHub App is installed and authorized
  • Verify “PR Checks” is enabled
  • Check that test plan is configured

Tip: Link issues to pull requests automatically by including issue number in PR title or branch name (e.g., fix/gh-1234-button-issue).