> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rehearsal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub PR Bot

> Automated testing on every pull request

**Run tests automatically when code changes. Get results as PR comments.**

## Installation

<Steps>
  <Step title="Install GitHub App">
    Go to [github.com/apps/rehearsal-ai](https://github.com/apps/rehearsal-ai) and click Install
  </Step>

  <Step title="Select Repositories">
    Choose which repos should run tests on PRs
  </Step>

  <Step title="Create Test Suite">
    In Rehearsal dashboard, create a test suite for your repo
  </Step>

  <Step title="Open a PR">
    Bot runs tests automatically and posts results as comments
  </Step>
</Steps>

## How It Works

1. **PR opened** → Bot detects code changes
2. **Select tests** → Runs relevant tests based on changed files
3. **Execute** → Tests run in cloud browsers
4. **Report** → Results posted as PR comment with pass/fail status

## Example PR Comment

```markdown theme={null}
## Rehearsal Test Results ✅

**3 tests passed** | 0 failed | Runtime: 45s

✅ Login flow
✅ Checkout process
✅ Search functionality

View full results: [Dashboard Link]
```

## Configuration

Control which tests run on which PRs:

* **Test suites** → Group tests by feature area
* **Branch rules** → Only run on `main`, `staging`, etc.
* **File patterns** → Run tests when specific files change

<Note>
  Free tier: 50 test runs/month. Paid: Unlimited.
</Note>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Bot not commenting on PRs">
    Check GitHub App permissions. Repo needs "Pull requests: Read & Write" enabled.
  </Accordion>

  <Accordion title="Tests failing in CI but passing locally">
    Environment variables might be missing. Add secrets in Rehearsal dashboard settings.
  </Accordion>

  <Accordion title="Tests taking too long">
    Split into multiple test suites. Run critical tests first, full suite nightly.
  </Accordion>
</AccordionGroup>

<CardGroup cols={2}>
  <Card title="Creating Tests" icon="wand-magic-sparkles" href="/creating-tests">
    Learn how to write effective tests
  </Card>

  <Card title="Running Tests" icon="play" href="/running-tests">
    Execute tests manually or in CI/CD
  </Card>
</CardGroup>
