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

# GitHub Actions

> Integrate QA.tech testing into GitHub Actions workflows

Use the official QA.tech GitHub Action to trigger test runs from your workflows. This gives you full control over which test plans run, when they run, and which environments to test.

<Note>
  **Looking for AI-powered testing?** The [GitHub App](/configuration/github-app) provides automatic test creation and PR reviews. This page covers the GitHub Action for API-driven testing.
</Note>

## Setup

<Steps>
  <Step title="Configure Secrets">
    Add secrets to your GitHub repository (**Settings → Secrets and variables → Actions**):

    * `QATECH_API_TOKEN` - Your QA.tech API token
    * `QATECH_PROJECT_ID` - Your QA.tech project ID

    Find these in your [project settings](https://app.qa.tech/current-project/settings/integrations).
  </Step>

  <Step title="Create Workflow">
    Create `.github/workflows/qatech.yml`:

    ```yaml theme={null}
    name: QA.tech Tests
    on:
      push:
        branches: [main]

    jobs:
      test:
        runs-on: ubuntu-latest
        steps:
          - uses: QAdottech/run-action@v2
            with:
              project_id: ${{ secrets.QATECH_PROJECT_ID }}
              api_token: ${{ secrets.QATECH_API_TOKEN }}
              blocking: true
    ```
  </Step>
</Steps>

## Implementation Patterns

### Run on Pull Requests

```yaml theme={null}
name: PR Tests
on:
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: QAdottech/run-action@v2
        with:
          project_id: ${{ secrets.QATECH_PROJECT_ID }}
          api_token: ${{ secrets.QATECH_API_TOKEN }}
          test_plan_short_id: 'smoke-tests'
          blocking: true
```

### Test Preview Deployments

```yaml theme={null}
name: Test Preview
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  deploy:
    runs-on: ubuntu-latest
    outputs:
      preview_url: ${{ steps.deploy.outputs.url }}
    steps:
      - name: Deploy to Vercel
        id: deploy
        run: |
          # Your deployment logic
          echo "url=https://preview-${{ github.event.pull_request.number }}.vercel.app" >> $GITHUB_OUTPUT

  test:
    needs: deploy
    runs-on: ubuntu-latest
    steps:
      - uses: QAdottech/run-action@v2
        with:
          project_id: ${{ secrets.QATECH_PROJECT_ID }}
          api_token: ${{ secrets.QATECH_API_TOKEN }}
          test_plan_short_id: 'regression-suite'
          blocking: true
          applications_config: |
            {
              "applications": {
                "frontend-app": {
                  "environment": {
                    "url": "${{ needs.deploy.outputs.preview_url }}",
                    "name": "PR-${{ github.event.pull_request.number }}"
                  }
                }
              }
            }
```

### Scheduled Testing

```yaml theme={null}
name: Nightly Tests
on:
  schedule:
    - cron: '0 2 * * *'  # Daily at 2 AM UTC

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: QAdottech/run-action@v2
        with:
          project_id: ${{ secrets.QATECH_PROJECT_ID }}
          api_token: ${{ secrets.QATECH_API_TOKEN }}
          test_plan_short_id: 'full-regression'
          blocking: false
```

### Use Action Outputs

```yaml theme={null}
- uses: QAdottech/run-action@v2
  id: qatech
  with:
    project_id: ${{ secrets.QATECH_PROJECT_ID }}
    api_token: ${{ secrets.QATECH_API_TOKEN }}
    blocking: true

- name: Check Results
  if: steps.qatech.outputs.run_result == 'FAILED'
  run: echo "Tests failed! See ${{ steps.qatech.outputs.run_url }}"
```

## Action Reference

### Inputs

| Input                 | Description                                                   | Required | Default               |
| :-------------------- | :------------------------------------------------------------ | :------- | :-------------------- |
| `project_id`          | Your QA.tech project ID                                       | Yes      | -                     |
| `api_token`           | QA.tech API token                                             | Yes      | -                     |
| `test_plan_short_id`  | Test plan short ID to run                                     | No       | All tests             |
| `blocking`            | Wait for test results before completing                       | No       | `false`               |
| `applications_config` | JSON with application environment and device preset overrides | No       | -                     |
| `api_url`             | Custom API URL                                                | No       | `https://app.qa.tech` |

### Outputs

| Output         | Description                                                                   |
| :------------- | :---------------------------------------------------------------------------- |
| `run_created`  | Whether the test run was created successfully                                 |
| `run_short_id` | The short ID of the run                                                       |
| `run_url`      | The URL of the run                                                            |
| `run_status`   | Final status (`COMPLETED`, `ERROR`, `CANCELLED`) - only when `blocking: true` |
| `run_result`   | Test result (`PASSED`, `FAILED`, `SKIPPED`) - only when `blocking: true`      |

## Direct API Alternative

If you prefer curl over the Action, use the [Start Run API](/api-reference/start-run) to trigger runs and the [Run Status API](/api-reference/run-status) for polling in non-blocking workflows.

## Related Documentation

* **[CI/CD Integration](/configuration/ci-cd-integration)** - Overview of integration modes
* **[GitHub App](/configuration/github-app)** - AI-powered automatic PR reviews
* **[API Reference](/api-reference/start-run)** - Complete API documentation
* **[Notifications](/core-concepts/notifications)** - Slack notification configuration
