# GitHub Integration

Learn how to integrate Buddy Unit Tests with GitHub Actions and enable commit checks.

## Sending Test Results from GitHub Actions

You can send test results to Buddy directly from GitHub Actions workflows. Use Buddy reporters or JUnit XML + the Buddy CLI in your GHA jobs. This allows Buddy to track sessions even when tests are not executed in a Buddy pipeline.

### Secret configuarion in GitHub

To use `BUDDY_UT_TOKEN` in GitHub Actions, you first need to add it as a secret in your repository settings:

1. Navigate to **Settings** > **Secrets and variables** > **Actions** in your GitHub repository
2. Click **New repository secret**
3. Enter the name: `BUDDY_UT_TOKEN`
4. Enter the token from the suite settings in Buddy
5. Click **Add secret**

![GitHub Actions Secret Configuration](/docs/tests/unit-tests/github-secret.png 640x389)

### Example GitHub Actions Workflow

```yaml
name: Tests
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '20'
      - name: Install dependencies
        run: npm ci
      - name: Run tests
        env:
          BUDDY_UT_TOKEN: ${{ secrets.BUDDY_UT_TOKEN }}
        run: npm test
```

## GitHub Commit Checks

For each test session, Buddy can create a commit check in GitHub under the following context: `/buddy/tests/<suite-name>`.

![GitHub Commit Check Status](/docs/tests/unit-tests/github-commit-check.png 640x147)

### Check Statuses

- `pending` - tests are waiting to be executied
- `in progress` - tests are running
- `passed` - all tests passed 
- `failed` - one ore more tests failed 

### Check Details

Each check contains

- Total failed/passed amount
- Pass rate
- Number of slow and flaky tests 
- A short table of failed tests
- Full report link

### Disabling Commit Checks

You can disable commit checks for each suite in the **Suite Settings** by enabling the **Don't send statuses to GitHub** option.

![GitHub Commit Status Settings](/docs/tests/unit-tests/github-comit-status.png 640x346)


---
Original source: https://buddy.works/docs/tests/unit-tests/github-integration