> ## 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 pull request testing

> Review a GitHub pull request on a preview URL, after merge, or against a mobile build.

Use this when the change is a GitHub pull request. To run a test plan you already have, use [GitHub regression testing](https://docs.qa.tech/regression-testing/github.md).

## Set it up

> [card] [GitHub App](#github-app)
>
> Automatic review on every pull request. Needs a preview URL from a
> deployment or a `@qa.tech` comment.

> [card] [Change Review Action](#change-review-action)
>
> Start the review from a workflow, after a deploy job or on a label. The App
> must still be installed.

> [card] [After merge](#after-merge)
>
> No preview environment. Review the merged pull request against staging or
> production.

> [card] [Post-merge agent](#post-merge-agent)
>
> After a reviewed pull request merges, promote tests from that review into
> the suite.

> [card] [Mobile build](#mobile-build)
>
> Upload the simulator or emulator build and pin the review to it.

> [card] [Cloud Run example](#example-cloud-run-preview-per-pull-request)
>
> Start the review when the pull request opens, then send the Cloud Run
> preview URL once the deploy finishes.

To publish preview URLs from Actions, create [GitHub Deployments](https://docs.qa.tech/configuration/github-deployments.md). A preview behind Vercel deployment protection needs the [Vercel preview bypass](https://docs.qa.tech/configuration/vercel-preview-protection.md).

## What works on GitHub

| Capability | GitHub |
| :- | :- |
| Review on a preview URL, before merge | Yes. The GitHub App, or the Change Review Action when the review must wait for your deploy job. |
| Review after merge, with no preview URL | Yes. A workflow on the default branch runs the review against the deployed environment. |
| Review a mobile build for that pull request | Yes. Upload the binary from Actions and pin the review to it. The App alone tests the default build. |
| Run a regression test plan | Not from this guide. The Test Run Action does that. See [GitHub regression testing](https://docs.qa.tech/regression-testing/github.md). |
| Block the workflow until the review finishes | Yes on the Change Review Action. The automatic GitHub App posts the review and does not fail the workflow. |

## What this does not do

* The GitHub App does not test the pull request's mobile binary. CI has to upload that build.
* The automatic App does not fail the GitHub check's workflow job. Use the Change Review Action when the job should wait.
* This setup does not run a test plan you picked. That is [GitHub regression testing](https://docs.qa.tech/regression-testing/github.md).

## GitHub App

The App starts a review when a pull request opens or updates, and when someone comments `@qa.tech`. Install and repository settings are on [GitHub App](https://docs.qa.tech/configuration/github-app.md). To skip pull requests you do not want tested, edit the [PR triage prompt](https://docs.qa.tech/pr-testing/pr-triage.md).

What a review does, how it selects tests, and when it creates tests are the same on every CI. See [How a review works](https://docs.qa.tech/pr-testing/overview.md#how-a-review-works).

### What the GitHub App posts

The GitHub App needs write permissions to communicate test results back to your PR. Here is what it posts and when:

| Operation | When | Description |
| :- | :- | :- |
| **Review comment** | When the agent starts testing, and when the review finishes | One QA.tech comment per pull request. While testing, it shows progress and a link to the QA.tech conversation. When the review finishes, it is replaced by a new comment with the verdict, summary, test results, and earlier reviews. |
| **Introduction comment** | When a pull request opens before its preview deployment is ready | Says the review starts once a deployment is available, or when you comment `@qa.tech`. Turn it off with **Post introduction comment**. |
| **Waiting for deployment** | When you comment `@qa.tech` without a URL and no preview deployment is ready | Says the review starts automatically once a deployment is ready. The review comment replaces it when testing starts. |
| **PR comment (quota limit)** | When the organization is out of credits | One comment per commit with an **Add credits** link. When QA.tech has found issues on more than 1% of the reviewed pull requests, it also says how many pull requests it has reviewed and issues it has found in your organization. No tests run. |
| **Reaction (eyes emoji)** | When processing starts | Added to the triggering comment or PR to acknowledge it has been seen. |
| **Commit status** | During and after test run | GitHub check named **QA.tech / PR Review** on the PR commit. See [PR Review check](#pr-review-check) below for when it appears and what each state means. |

While testing, the review comment is edited in place with a short checklist: reading the pull request, exploring the codebase, planning tests, running tests with a finished count, and checking results. The test count grows when the agent adds or reruns tests. Edits do not send GitHub notifications. The comment's second line is a hidden marker such as `<!-- qa.tech:state=running sha=abc1234 tests=5/9 -->` that your own automation can read instead of the text.

When a later commit is reviewed, the same review comment shows the new progress and the previous result, and the finished review lists earlier reviews of the pull request. A later commit that [PR triage](https://docs.qa.tech/pr-testing/pr-triage.md#updates-to-a-pull-request) skips does not replace that comment. When an earlier review passed or failed, the check on the new commit keeps that result. Otherwise the check is set to skipped.

That review stays in one conversation. A later commit or another `@qa.tech` comment continues it. The agent can rerun tests the new commits affect, and it can change or drop tests it created for this pull request when they no longer match. Stopping a run ends that browser session, and the next run starts from the beginning. A [Resume From](https://docs.qa.tech/core-concepts/dependencies.md#resume-from) dependency starts a later test from a saved login.

Two reviews of the same change can pick slightly different tests. [PR Review Rules](https://docs.qa.tech/core-concepts/knowledge.md#rules) and review context in the integration settings make later runs follow the same guidance.

> [!TIP]
>
> If you see permission errors when installing the app, ensure the repository
> grants write access for pull requests and statuses. The app only writes for
> reviews and when the organization is out of credits.

### PR Review check

QA.tech registers a GitHub check run named **QA.tech / PR Review** on PR commits. You can require it in branch protection as a merge gate. Whether a check appears on PR open or sync depends on the [integration settings](https://docs.qa.tech/configuration/github-app.md#integration-settings) and how the review was triggered.

| Situation | Check created on PR open/sync? | What you see |
| :- | :- | :- |
| **Auto-run on PRs** enabled (default) | Yes | `in progress` while the agent reviews, then a final verdict (approve, request changes, or comment) |
| **Auto-run on PRs** disabled | No | No check until you explicitly trigger a review (see below) |
| Draft PR and **Include draft PRs** disabled | Yes (skipped) | Skipped check titled **Draft PR** - auto-review does not run on drafts until the PR is marked ready for review, or until you comment `@qa.tech` |
| **PR triage** enabled and the pull request cannot be tested | Yes | `in progress`, then a skipped check titled **Review skipped** with the reason. No review comment is posted or changed |
| Comment `@qa.tech` on the PR | Yes (when the review starts) | `in progress`, then final verdict |
| [Change Review Action](https://docs.qa.tech/pr-testing/github#change-review-action) or [Start change review chat API](https://docs.qa.tech/api-reference/chat/start-change-review-chat.md) | Yes (when triggered) | `in progress`, then final verdict. Runs even when **Auto-run on PRs** is off |

> [!NOTE]
>
> **Auto-run on PRs** controls only the automatic PR-open trigger. It does not block explicit triggers: `@qa.tech` comments, the Change Review Action, and the change-review API always start a review (and create or update the check) when invoked.
>
> When **Auto-run on PRs** is off, QA.tech does **not** post a skipped check that says auto-review is disabled. The PR simply has no QA.tech check until you trigger a review manually or from CI.

### Triggering a PR Review

#### Automatic trigger (simple)

With **Run automatically on PRs** enabled, QA.tech starts a review when a PR is opened or updated and its preview deployment is ready. This is the simplest option once a repository is configured. The first review is triaged against the whole pull request. After that review finishes, a new push is triaged against only the diff since that review. See [Updates to a pull request](https://docs.qa.tech/pr-testing/pr-triage.md#updates-to-a-pull-request).

> [!NOTE]
>
> Automatic triggering works best when you have a **single application**
> deployed via [GitHub Deployments](https://docs.qa.tech/configuration/github-deployments.md) (or a
> provider that creates them, such as Netlify or Vercel) and you don't need
> extra control over when reviews run. If you have multiple applications per PR,
> don't use deployment-based previews, or need to gate reviews on labels, paths,
> or a specific deploy job, use the [Change Review
> Action](#change-review-action) instead.

#### Manual trigger with an `@qa.tech` comment

You can trigger a review at any time by commenting `@qa.tech` on the pull request. This works on the main PR conversation and on inline code review comments, even when **Run automatically on PRs** is turned off or a previous review was abandoned.

Turn **Run automatically on PRs** off when reviews should start only from an `@qa.tech` comment. [PR triage](https://docs.qa.tech/pr-testing/pr-triage.md) does not skip that comment. The Change Review Action and the change-review API still follow triage unless the request turns it off.

The mention is case-insensitive (`@QA.tech`, `@qatech`, and similar variants all match). When QA.tech picks up the comment, it reacts with an eyes emoji to acknowledge it.

| Comment | What happens |
| :- | :- |
| `@qa.tech` | Re-runs the review. QA.tech waits for a ready preview deployment on the PR's latest commit, then starts automatically. |
| `@qa.tech test the checkout flow` | Runs a focused review. Any instructions after the mention are passed to the agent to steer what it tests. |
| `@qa.tech https://preview.example.com` | Runs immediately against the URL in the comment, which is treated as the preview deployment to test (skips waiting for a deployment). |

> [!NOTE]
>
> Without a URL in the comment, QA.tech waits for a ready preview deployment on
> the PR's latest commit. It posts a short "waiting for a preview deployment"
> comment and starts the review automatically once one is ready. Include a
> preview URL in the comment to start immediately against that environment.

#### Re-run from the GitHub checks UI

Every review posts a status check on the PR commit. You can re-trigger a review by using GitHub's **Re-run** button on the QA.tech check, the same way you re-run any other CI check.

## Change Review Action

The Change Review Action still needs the [GitHub App](https://docs.qa.tech/configuration/github-app.md) installed at the organization level with access to the repository. The action does not replace that connection: without it, the agent cannot read the PR or post the review.

Start the review from a workflow when it must wait for a deploy job, a label, or a preview URL you pass in. It runs the same review agent and posts the same native PR review as the App. Turn off **Run automatically on PRs** in **Settings → Integrations → GitHub App** when the workflow drives the review, so each pull request is not reviewed twice.

The action calls [`POST /v1/chat/change-review`](https://docs.qa.tech/api-reference/chat/start-change-review-chat) with the PR URL and, once your preview is deployed, your per-PR environment overrides. It starts a review and creates the **QA.tech / PR Review** check even when **Auto-run on PRs** is off. A review with no preview environment is [After merge](#after-merge). A mobile binary is [Mobile build](#mobile-build). Pass extra testing guidance with the `context` input the same way as on [API pull request testing](https://docs.qa.tech/pr-testing/api.md#pass-extra-context).

### Setup

You do **not** need to map the repository to a project in QA.tech (that mapping only powers the App's automatic trigger); the action passes the repo and preview URLs inline.

**1. Install the GitHub App**

If you haven't already, follow [Install GitHub App](https://docs.qa.tech/configuration/github-app.md#how-to-set-it-up) to connect the App under **Settings → Integrations → GitHub App** and grant it access to the repository you want reviewed. Without the App (or repo access), the action's chat will start but the agent has no permission to read your PR. You do **not** need to create a repository mapping under **Settings → Integrations → GitHub App** for the action; that mapping is only needed for the App's automatic PR trigger.

**2. Disable Auto-run on PRs (optional)**

This step only applies if you have also mapped the repository under **Settings
→ Integrations → GitHub App** to enable the App's automatic trigger. If you
want the action to be the only thing that triggers reviews on this repo, open
that page and turn off **Auto-run on PRs**. With auto-run off, QA.tech does
not create a **QA.tech / PR Review** check on PR open; the check appears when
this action (or a `@qa.tech` comment) runs. Leave auto-run on if you want both
the automatic trigger and on-demand action runs. If you never mapped the
repository, there is no automatic trigger to disable.

**3. Configure Secrets**

Add a secret to your GitHub repository (**Settings → Secrets and variables →
Actions**). Create the token in **Organization Settings → API Keys**. Store it
as `QATECH_API_TOKEN`. Pass `project_short_id` from the project URL or
Settings (for example `proj_abc123`).

**4. Find your application short IDs**

Copy application short IDs from **Settings → Applications & Envs** (three-dot
menu → **Copy Short ID**), for example `app_abc123`. **Test Plans → API
Integration** is a shortcut only when the app is already on a plan. New mobile
apps often have no plan yet. Projects with more than one application should
pass one entry per app so the agent knows which URL to test against.

**5. Create Workflow**

Create `.github/workflows/qatech-change-review.yml` with a prepare job, your deploy job, and a review job:

```yaml theme={null}
name: QA.tech Change Review
on:
  pull_request:

concurrency:
  group: qatech-change-review-${{ github.event.number }}
  cancel-in-progress: true

jobs:
  qatech-prepare:
    runs-on: ubuntu-latest
    steps:
      - uses: QAdottech/run-action/change-review-prepare@v4
        with:
          project_short_id: 'proj_abc123'
          api_token: ${{ secrets.QATECH_API_TOKEN }}
          commit_hash: ${{ github.event.pull_request.head.sha }}

  deploy:
    runs-on: ubuntu-latest
    outputs:
      preview_url: ${{ steps.deploy.outputs.preview_url }}
    steps:
      - id: deploy
        run: ./deploy-preview.sh # Your deploy; writes preview_url to $GITHUB_OUTPUT

  qatech-review:
    needs: [deploy]
    runs-on: ubuntu-latest
    steps:
      - uses: QAdottech/run-action/change-review@v4
        with:
          project_short_id: 'proj_abc123'
          api_token: ${{ secrets.QATECH_API_TOKEN }}
          applications_config: |
            {
              "applications": {
                "YOUR_APP_SHORT_ID": {
                  "environment": {
                    "url": "${{ needs.deploy.outputs.preview_url }}"
                  }
                }
              }
            }
```

`qatech-prepare` runs as soon as the PR opens or gets a new commit. The agent reads the change and creates the tests it plans to run, without running them yet. `qatech-review` sends the preview URL once `deploy` finishes. QA.tech treats that request as the deployment being ready, and the prepared review runs its tests against the preview. The review finishes sooner because the research overlaps the deploy.

Pass the same `commit_hash` / API `commitHash` (`github.event.pull_request.head.sha`) on **both** jobs so each push is triaged and reviewed for that commit. Without it, a fast CI job can still see the previous head in the database and skip prepare or review for the wrong commit.

If `qatech-review` arrives before `qatech-prepare` has started, or without a prepare job, it runs a full review on its own. The `concurrency` group cancels the jobs of an older commit when a new one is pushed.

On `pull_request` events the action reads the PR URL from `github.event.pull_request.html_url` automatically, so `pr_url` is optional.

> [!NOTE]
>
> `commit_hash` maps to the `commitHash` field on [Prepare change review](https://docs.qa.tech/api-reference/chat/prepare-change-review.md) and [Start change review chat](https://docs.qa.tech/api-reference/chat/start-change-review-chat.md). If you call those endpoints with `curl` instead of the actions, include `"commitHash": "${{ github.event.pull_request.head.sha }}"` in the JSON body on both calls.

#### Single job

When the preview URL is known up front, or you don't need the review to start before the deploy, drop `qatech-prepare` and keep only the review job. It reads the change, creates tests, and runs them in one go.

### Example: Cloud Run preview per pull request

This workflow deploys each pull request to Google Cloud Run as a tagged revision that takes no production traffic, so every pull request gets its own URL. Two things happen:

1. When the pull request opens or gets a new commit, `qatech-prepare` starts the review. The agent reads the change and plans its tests while Cloud Run builds.
2. When the deploy finishes, `qatech-review` sends the revision URL to QA.tech, and the tests run against it.

Before you add it:

* The [GitHub App](https://docs.qa.tech/configuration/github-app.md#how-to-set-it-up) is installed with access to the repository. Turn off **Auto-run on PRs** for the repository so each pull request is not reviewed twice.
* A `QATECH_API_TOKEN` repository secret from **Organization Settings → API Keys**, your `project_short_id`, and your application short ID.
* GitHub Actions can deploy to Cloud Run. This example uses [Workload Identity Federation](https://github.com/google-github-actions/auth#workload-identity-federation-through-a-service-account) through `google-github-actions/auth`. Store the provider and service account as the `GCP_WORKLOAD_IDENTITY_PROVIDER` and `GCP_SERVICE_ACCOUNT` secrets.
* QA.tech can reach the revision URL. Cloud Run URLs require authentication unless the service allows unauthenticated invocations. If yours does not, see [Environment access](https://docs.qa.tech/configuration/environment-access.md).

Create `.github/workflows/qatech-cloud-run-review.yml`. Replace `my-service`, `europe-west1`, `proj_abc123`, and `YOUR_APP_SHORT_ID` with your values.

```yaml theme={null}
name: Cloud Run preview and QA.tech review
on:
  pull_request:
    types: [opened, synchronize, reopened]

concurrency:
  group: qatech-cloud-run-${{ github.event.number }}
  cancel-in-progress: true

env:
  SERVICE: my-service
  REGION: europe-west1

jobs:
  qatech-prepare:
    runs-on: ubuntu-latest
    steps:
      - uses: QAdottech/run-action/change-review-prepare@v4
        with:
          project_short_id: 'proj_abc123'
          api_token: ${{ secrets.QATECH_API_TOKEN }}
          commit_hash: ${{ github.event.pull_request.head.sha }}

  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write # Needed for Workload Identity Federation
    outputs:
      preview_url: ${{ steps.url.outputs.preview_url }}
    steps:
      - uses: actions/checkout@v4

      - uses: google-github-actions/auth@v2
        with:
          workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
          service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}

      - uses: google-github-actions/setup-gcloud@v2

      - name: Deploy a tagged revision with no traffic
        run: |
          gcloud run deploy "$SERVICE" \
            --source . \
            --region "$REGION" \
            --tag "pr-${{ github.event.number }}" \
            --no-traffic \
            --quiet

      - name: Read the revision URL
        id: url
        run: |
          URL=$(gcloud run services describe "$SERVICE" --region "$REGION" --format=json \
            | jq -r --arg tag "pr-${{ github.event.number }}" '.status.traffic[] | select(.tag == $tag) | .url')
          echo "preview_url=$URL" >> "$GITHUB_OUTPUT"

  qatech-review:
    needs: [deploy]
    runs-on: ubuntu-latest
    steps:
      - uses: QAdottech/run-action/change-review@v4
        with:
          project_short_id: 'proj_abc123'
          api_token: ${{ secrets.QATECH_API_TOKEN }}
          commit_hash: ${{ github.event.pull_request.head.sha }}
          applications_config: |
            {
              "applications": {
                "YOUR_APP_SHORT_ID": {
                  "environment": {
                    "url": "${{ needs.deploy.outputs.preview_url }}",
                    "name": "PR-${{ github.event.number }}"
                  }
                }
              }
            }
```

Notes:

* `--tag pr-<number>` gives the revision a stable URL such as `https://pr-42---my-service-abc123-ew.a.run.app`. A new commit on the same pull request moves the tag to the new revision, so the URL stays the same.
* `--no-traffic` keeps production traffic on the current revision. Only the tag URL serves the pull request. Cloud Run rejects `--no-traffic` when it creates a service, so deploy the service once before you add this workflow.
* If you build an image yourself, replace `--source .` with `--image` and your Artifact Registry image.
* Add `blocking: true` to `qatech-review` to fail the workflow when the review fails. See [Block the workflow until the review finishes](#block-the-workflow-until-the-review-finishes).

To remove the tag when the pull request closes, add a second workflow:

```yaml theme={null}
name: Remove Cloud Run preview tag
on:
  pull_request:
    types: [closed]

jobs:
  cleanup:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write
    steps:
      - uses: google-github-actions/auth@v2
        with:
          workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
          service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
      - uses: google-github-actions/setup-gcloud@v2
      - run: |
          gcloud run services update-traffic my-service \
            --region europe-west1 \
            --remove-tags "pr-${{ github.event.number }}"
```

Without preview deployments, deploy `main` to a staging Cloud Run service and review after merge instead. Use the [After merge](#after-merge) workflow and put your `gcloud run deploy` steps in its `deploy` job.

### Change Review Action reference

#### Inputs

| Input | Description | Required | Default |
| :- | :- | :- | :- |
| `project_short_id` | QA.tech project short ID (for example `proj_abc123`) | Yes | - |
| `api_token` | QA.tech API token | Yes | - |
| `applications_config` | JSON of `{ "applications": { "<applicationShortId>": { "environment": { ... }, "devicePresetShortId": "..." } } }`. Each application must include an `environment`. | Yes | - |
| `blocking` | Wait for the assistant reply and expose it as an output. Fails the step on `FAILED` or `CANCELLED`. | No | `false` |
| `context` | Free-form context appended to the review. | No | - |
| `commit_hash` | PR head commit SHA (`github.event.pull_request.head.sha`). Sent as API `commitHash` so prepare, triage, and review apply to that commit. | No | Stored pull request head |
| `pr_url` | Pull request URL to review. Defaults to the PR URL of the current `pull_request` event. | No | Auto-detected on PR events |
| `disable_review_comments` | `true` stops the agent from posting review comments on the PR. The review still runs and is shown in QA.tech, and the PR Review check is still reported. Sent as API `disableReviewComments`. | No | `false` |
| `api_url` | Custom API URL. | No | `https://api.qa.tech` |

Each environment in `applications_config` must include one of:

* `url` (plus optional `name`) to point the application at a preview URL.
* `shortId` to reference an existing environment short ID.
* `applicationBuildShortId` to reference a previously uploaded mobile build.

Optional `customHeaders` on any of those shapes persist host-pattern header rules on the environment (auth and protection bypass), and optional `basicAuth` persists domain-scoped HTTP basic auth. Omit a field to leave stored values unchanged; pass `[]` to clear it. See [Environment custom headers](https://docs.qa.tech/core-concepts/applications-and-environments.md#custom-headers) and [Environment basic auth](https://docs.qa.tech/core-concepts/applications-and-environments.md#basic-auth).

See [Start change review chat API](https://docs.qa.tech/api-reference/chat/start-change-review-chat.md) for the request schema this maps to.

#### How runs are attributed

Runs started by a change review are labelled with the branch, commit, and author of the change under review, the same way Test Run Action runs are. Send optional git trigger fields (`branch`, `commitHash`, `commitMessage`, `actor`, `repository`) on the change-review API request from your workflow context.

`commitHash` is not only for dashboard labels: it selects which commit's prepare round, triage outcome, and deployment wake apply. Pass `github.event.pull_request.head.sha` on every prepare and review call from CI. The [GitHub App](https://docs.qa.tech/pr-testing/github#github-app) webhook flow already uses the event's head SHA; the API and Action flows rely on you sending `commitHash` (or `commit_hash` on the action) explicitly.

When `commitHash` is omitted, QA.tech falls back to the head commit stored on the pull request row, which can lag a few seconds behind GitHub on `synchronize`.

#### Outputs

The agent posts its review natively on the PR. These outputs let you link to or log the chat conversation from your workflow; they are not the PR review body.

| Output | Description |
| :- | :- |
| `chat_created` | `"true"` when the chat conversation was created successfully. |
| `chat_short_id` | Short ID of the change review chat conversation (e.g. `chat_abc123`). |
| `chat_url` | Dashboard URL of the chat. Always set, even when not blocking. |
| `chat_status` | Final status of the agent's assistant message: `COMPLETED`, `FAILED`, `CANCELLED`, or `TIMED_OUT`. Only set when `blocking: true`. |
| `chat_response` | The agent's final assistant text in the chat (free-form, may summarize what was done). Not the GitHub PR review body. Only set when `blocking: true`. |

#### How polling works

When `blocking: true`, the action polls [`GET /v1/chat/{chat_short_id}`](https://docs.qa.tech/api-reference/chat/get-chat-conversation) every 20 seconds until the conversation `status` is terminal, so test runs started by the review count as still in progress:

| Conversation status | Action behavior |
| :- | :- |
| `in_progress` | Continues polling. |
| `completed` | Sets `chat_status` to `COMPLETED` and `chat_response`. Step succeeds. |
| `failed` | Sets `chat_status` to `FAILED` and `chat_response`. Step fails via `core.setFailed`. |
| `cancelled` | Sets `chat_status` to `CANCELLED` and `chat_response`. Step fails via `core.setFailed`. |
| *(60 minutes elapsed)* | Sets `chat_status` to `TIMED_OUT`. Step fails via `core.setFailed`. |

Polling stops after an internal 60-minute timeout. Set a shorter [`timeout-minutes`](https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution#jobsjob_idstepstimeout-minutes) on the step if you need a tighter cap.

### Change Review Prepare Action reference

`QAdottech/run-action/change-review-prepare` starts the review before the preview is deployed. It calls [Prepare change review](https://docs.qa.tech/api-reference/chat/prepare-change-review.md) and returns once the conversation exists. It takes `project_short_id`, `api_token`, `context`, `pr_url`, `commit_hash`, `disable_review_comments`, and `api_url`, with the same meaning as on the review action, and sets `chat_created`, `chat_short_id`, and `chat_url`. It has no `applications_config` or `blocking`: the prepared review runs its tests when the review job sends the preview with the same head commit.

### Change review implementation patterns

#### Review without posting comments on the PR

Set `disable_review_comments: true` when you do not want QA.tech to comment on your pull requests, for example while you evaluate it. Every PR is still reviewed: the review shows up in the QA.tech conversation and on the pull request page, and the **QA.tech / PR Review** check is still reported on the commit. The setting is stored on the PR's review conversation, so set it on the prepare job; later reviews of the same PR stay silent until a request sends `false`.

```yaml theme={null}
- uses: QAdottech/run-action/change-review-prepare@v4
  with:
    project_short_id: 'proj_abc123'
    api_token: ${{ secrets.QATECH_API_TOKEN }}
    commit_hash: ${{ github.event.pull_request.head.sha }}
    disable_review_comments: 'true'
```

Calling the API directly, send `"disableReviewComments": true` on [Prepare change review](https://docs.qa.tech/api-reference/chat/prepare-change-review.md) or [Start change review chat](https://docs.qa.tech/api-reference/chat/start-change-review-chat.md).

#### Block the workflow until the review finishes

By default the action returns as soon as the chat conversation is created and the agent starts working. Set `blocking: true` to wait for the agent to finish (and post its native PR review) before the workflow step completes. The step fails when the review ends in `FAILED` or `CANCELLED`, which makes it suitable as a deployment gate.

```yaml theme={null}
- uses: QAdottech/run-action/change-review@v4
  id: review
  with:
    project_short_id: 'proj_abc123'
    api_token: ${{ secrets.QATECH_API_TOKEN }}
    blocking: true
    applications_config: |
      {
        "applications": {
          "YOUR_APP_SHORT_ID": {
            "environment": {
              "url": "https://preview-${{ github.event.number }}.example.com"
            }
          }
        }
      }

- name: Log conversation
  if: always()
  run: |
    echo "Status: ${{ steps.review.outputs.chat_status }}"
    echo "Conversation URL: ${{ steps.review.outputs.chat_url }}"
    echo "Final assistant message: ${{ steps.review.outputs.chat_response }}"
```

The native review is posted to the PR by the agent itself. `chat_response` is the agent's final assistant text in the chat (which may summarize what it did but is not the GitHub review body); use it for logging or further automation, not as a replacement for the PR review.

#### Route multiple applications to per-PR preview URLs

The most common reason to reach for this action over the GitHub App's automatic trigger: projects with more than one application per PR (for example a frontend, a backend, and an admin dashboard). Pass one entry per application so the agent knows which preview URL to use for each. Each entry must include an `environment` with at least one of `url`, `shortId`, or `applicationBuildShortId`.

```yaml theme={null}
- uses: QAdottech/run-action/change-review@v4
  with:
    project_short_id: 'proj_abc123'
    api_token: ${{ secrets.QATECH_API_TOKEN }}
    applications_config: |
      {
        "applications": {
          "app_frontend": {
            "environment": {
              "url": "https://preview-${{ github.event.number }}-web.example.com",
              "name": "PR-${{ github.event.number }}"
            }
          },
          "app_backend": {
            "environment": {
              "url": "https://preview-${{ github.event.number }}-api.example.com",
              "name": "PR-${{ github.event.number }}"
            }
          }
        }
      }
```

#### Override the device preset

Pass `devicePresetShortId` alongside `environment` to run the review against a specific [device preset](https://docs.qa.tech/test-features/device-presets.md):

```yaml theme={null}
applications_config: |
  {
    "applications": {
      "app_frontend": {
        "environment": { "url": "https://preview.example.com" },
        "devicePresetShortId": "preset_mobile_abc123"
      }
    }
  }
```

#### Add free-form context

Use the `context` input to guide the review with PR-specific or repo-wide instructions. You can also generate this context automatically with an AI agent — see [PR Testing best practices](https://docs.qa.tech/best-practices/pr-testing.md#pass-generated-context-to-the-change-review-action).

```yaml theme={null}
- uses: QAdottech/run-action/change-review@v4
  with:
    project_short_id: 'proj_abc123'
    api_token: ${{ secrets.QATECH_API_TOKEN }}
    context: |
      Focus on the new Apple Pay flow. Test login is shared with the existing
      checkout test and uses test-user@example.com.
    applications_config: |
      { "applications": { "YOUR_APP_SHORT_ID": { "environment": { "url": "https://preview.example.com" } } } }
```

#### Review a different PR

Set `pr_url` when the workflow runs outside a `pull_request` event (for example on `workflow_dispatch`):

```yaml theme={null}
on:
  workflow_dispatch:
    inputs:
      pr_url:
        description: PR to review
        required: true

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: QAdottech/run-action/change-review@v4
        with:
          project_short_id: 'proj_abc123'
          api_token: ${{ secrets.QATECH_API_TOKEN }}
          pr_url: ${{ inputs.pr_url }}
          applications_config: |
            { "applications": { "YOUR_APP_SHORT_ID": { "environment": { "shortId": "YOUR_STAGING_ENV_SHORT_ID" } } } }
```

## After merge

No preview environment. Review the merged pull request against staging or production.

If you do not have per-PR preview environments, run the change review **after** merging to your main branch. The workflow deploys to staging/production, extracts the PR number from the merge commit, and reviews the merged PR's changes against the deployed environment. Results are posted back on the merged PR as a comment.

### Before you start

Have these ready before you add the workflow:

* The [GitHub App](https://docs.qa.tech/configuration/github-app.md#how-to-set-it-up) installed with access to the repository. Without it, the agent cannot read the merged pull request or comment on it.
* Your staging environment in QA.tech, under **Settings → Applications & Envs**, with the URL your deploy job publishes to. Copy its environment short ID (three-dot menu → **Copy Short ID**), for example `env_abc123`, and the application short ID, for example `app_abc123`.
* Access from QA.tech to staging. If staging is private, behind a VPN, or behind basic auth, see [Environment access](https://docs.qa.tech/configuration/environment-access.md).
* A `QATECH_API_TOKEN` repository secret from **Organization Settings → API Keys**, and your `project_short_id` (for example `proj_abc123`).

### Where the review gets the URL

The workflow does not pass a URL. It passes the environment short ID in `applications_config`, and the agent tests the URL saved on that environment in QA.tech. If the staging URL changes, update the environment in QA.tech, not the workflow. To test a URL that is not saved as an environment, pass `"url": "https://staging.example.com"` instead of `shortId`.

### Add the workflow

Add the `change-review` job to the workflow that deploys your default branch. It has to be in the same workflow as the deploy job, because `needs:` only waits for jobs in the same workflow. Replace `YOUR_APP_SHORT_ID`, `YOUR_STAGING_ENV_SHORT_ID`, and `proj_abc123` with your IDs.

```yaml theme={null}
name: Deploy and Review
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      # Your existing deploy steps here
      - run: echo "Deploy to staging..."

  change-review:
    needs: deploy
    runs-on: ubuntu-latest
    steps:
      - name: Extract PR number from merge commit
        id: pr
        env:
          COMMIT_MSG: ${{ github.event.head_commit.message }}
        run: |
          PR_NUMBER=$(echo "$COMMIT_MSG" | grep -oE '\(#[0-9]+\)' | tail -1 | grep -oE '[0-9]+')
          if [ -n "$PR_NUMBER" ]; then
            echo "url=https://github.com/${{ github.repository }}/pull/$PR_NUMBER" >> "$GITHUB_OUTPUT"
            echo "found=true" >> "$GITHUB_OUTPUT"
          fi
      - name: Start QA.tech change review
        if: steps.pr.outputs.found == 'true'
        uses: QAdottech/run-action/change-review@v4
        with:
          project_short_id: 'proj_abc123'
          api_token: ${{ secrets.QATECH_API_TOKEN }}
          pr_url: ${{ steps.pr.outputs.url }}
          context: 'This PR has already been merged and deployed. Test the changes and report any issues found as a comment.'
          applications_config: |
            {
              "applications": {
                "YOUR_APP_SHORT_ID": {
                  "environment": {
                    "shortId": "YOUR_STAGING_ENV_SHORT_ID"
                  }
                }
              }
            }
```

Notes:

* The `change-review` job waits for `deploy` (`needs: deploy`), so the agent tests the code that just shipped.
* The PR number is extracted from GitHub's default merge/squash commit message format (`(#123)`).
* Direct pushes to `main` without a PR are skipped automatically (the review step is gated on `steps.pr.outputs.found`).

### Set it up with the MCP

With the [QA.tech MCP server](https://docs.qa.tech/integrations/mcp.md) connected in your editor, your coding agent can look up the IDs and write the job. Open the repository and paste:

```text theme={null}
Add a QA.tech after-merge change review to this repository's
GitHub Actions.

1. Find the workflow that deploys the default branch, and
   the staging URL it deploys to.
2. With the QA.tech MCP, call list_projects,
   list_applications, and list_application_environments to
   find the project short ID, application short ID, and the
   environment short ID whose URL matches staging.
3. If no environment matches, call create_chat with: "Create
   an environment named Staging with URL <staging URL> for
   application <application short ID>, check that QA.tech
   can reach it, and tell me whether <repository URL> is
   connected to the GitHub App." Poll get_chat_conversation
   until its status is completed, then list the environments
   again.
4. Read https://docs.qa.tech/pr-testing/github#after-merge
   and add the change-review job to that workflow, after the
   deploy job, with those IDs filled in.
5. Tell me to add the QATECH_API_TOKEN secret, and anything
   still missing in QA.tech.
```

## Post-merge agent

When a pull request is **merged**, QA.tech can run an autonomous **post-merge agent** to keep your test suite healthy — before the internal review retrospective runs. Configure it under **Settings → Integrations → GitHub App** with the **Run post-merge agent** toggle, which reveals a **Post-merge prompt** you can edit. These settings live on the GitHub App integration (alongside Auto-run on PRs and other merge-review options).

**New GitHub integrations** default the agent on with the default prompt prefilled. **Existing integrations** keep the agent off until you enable it (the default prompt is still prefilled in the form).

You can also pass per-PR options when starting a change review via the [Start change review chat API](https://docs.qa.tech/api-reference/chat/start-change-review-chat.md) or the [Change Review Action](#change-review-action). See [API and CI options](#post-merge-via-api-or-ci) below.

The key idea: **the prompt is the agent's entire goal.** The agent only changes tests when the prompt asks it to. If you point the prompt at something else (for example, "open a Linear issue summarizing the merge"), that is all it does — it will not touch your tests. The default prompt focuses on conservative regression maintenance.

The agent runs in the same conversation as the PR review, so it already has the review history — the tests that ran, their results, and the diff — as context. It reuses your existing test tools; there is nothing new to configure beyond the prompt.

### What it can do

Depending on your prompt, the agent can:

* **Promote review tests** into the regression suite. Only tests this PR's own reviews created — surfaced to the agent as "main candidates," still drafts and not last seen failing — can be promoted. Promoting activates a test (and its dependencies) and labels it `regression` + `auto-added` automatically, so you can filter for them in the test list. Promoting nothing is a normal outcome.
* **Update** tests whose behavior the merge changed so they match the merged state.
* **Convert to draft** tests that the merge made stale or irrelevant — cautiously, and only with strong, diff-grounded evidence. If another active test depends on one being drafted, the agent must confirm and draft the whole chain together; it never archives tests automatically.
* **Add tests to a test plan** (for example Smoke or Regression) when your prompt asks for it and defines the criteria.
* **Use connected integrations** — for example open a tracker issue, post or read a Slack update (when **Enable Slack Tools in Chat** is on), or (when you have connected MCP servers) run one of their tools — when your prompt asks for something other than test maintenance.

Before promoting or creating anything, the agent checks for an equivalent existing test to avoid duplicates, and it only keeps tests that will run reliably in a regression suite (no hard-coded names, IDs, or other data tied to a single PR). Labels are applied automatically on promotion — you do not manage them in the prompt.

### Example prompts

Use these as inspiration — copy, combine, or adapt them:

**Conservative regression maintenance (default):**

```
Now that this pull request is merged, update tests the merge changed, promote the
main-flow candidate tests that passed during review, and convert clearly stale tests to
draft. Skip edge cases. Never keep tests with hard-coded PR-specific data.
```

**Only cover normal end-user flows, not admin tooling:**

```
Maintain tests for this merge, but only for flows a normal end user would hit. Do not
promote or create tests that exercise admin-only screens or internal tooling.
```

**Add to the Smoke plan when criteria are met:**

```
Keep the regression suite healthy for this merge. If a promoted test covers a critical,
high-traffic flow (login, checkout, signup) and is stable, also add it to the "Smoke"
test plan.
```

**Be more aggressive about removing stale tests:**

```
After this merge, be proactive about converting tests to draft when the PR removed or
replaced the feature they cover. Explain your reasoning for each one you draft.
```

**Do something other than test maintenance:**

```
When this PR merges, open a Linear issue in the QA team summarizing the user-facing
changes and any test gaps you noticed during review. Do not modify any tests.
```

**Post a Slack summary after merge:**

Requires [Slack tools in chat](https://docs.qa.tech/integrations/slack.md#slack-tools-in-chat) to be enabled
for the project.

```
When this PR merges, post a short Slack summary of the user-facing changes to the
project's default Slack channel. Do not modify any tests.
```

> [!NOTE]
>
> The post-merge agent runs before the internal review retrospective, which
> always runs afterward regardless of whether the post-merge agent is enabled,
> skipped, or fails. Non-merged (closed) PRs skip the post-merge agent and go
> straight to the retrospective. When every review round was discarded, the
> post-merge agent does not start; the retrospective is still forwarded and then
> skips. A later discarded update does not remove an earlier completed review,
> so the post-merge agent still runs.

### Post-merge via API or CI

When you trigger a merge review with [`POST /v1/chat/change-review`](https://docs.qa.tech/api-reference/chat/start-change-review-chat) (`mode: "pr"`), you can pass optional `postMerge` options. Those options are stored on the review conversation and **override** the GitHub App integration settings for that PR only when it merges.

```bash theme={null}
curl -sSf -X POST "https://api.qa.tech/v1/chat/change-review" \
  -H "Authorization: Bearer $QATECH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "pr",
    "prUrl": "https://github.com/acme/web/pull/42",
    "vcsProviderId": "github",
    "applicationOverrides": [
      { "applicationShortId": "app_...", "environment": { "shortId": "env_..." } }
    ],
    "postMerge": {
      "enabled": true,
      "prompt": "After merge, promote stable main-flow review tests and draft clearly stale ones."
    }
  }'
```

| Field | Required | Description |
| :- | :- | :- |
| `postMerge.enabled` | Yes (when `postMerge` is sent) | `true` runs the post-merge agent after merge; `false` skips it even if the integration has it on |
| `postMerge.prompt` | No | Full goal for the agent. Omit or leave empty to use the default maintenance prompt |

Omit `postMerge` entirely to use the GitHub App integration toggle and prompt. From CI, pass the same JSON body to the change-review API (or wrap it in your own workflow step).

The same request accepts `"triage": { "enabled": false }` to always run that review, or `true` to let [PR triage](https://docs.qa.tech/pr-testing/pr-triage.md#reviews-started-from-the-api-or-github-action) skip it even when the integration toggle is off. Add `"prompt"` to replace the integration PR triage prompt for that review. Omit `triage` to follow the integration toggle and prompt.

Promoted tests are labelled `auto-added` for provenance today; a durable, structured link back to the originating pull request, and per-test-plan opt-in controls for automatic additions, are planned follow-ups.

## Mobile build

Store `QATECH_API_TOKEN` under **Settings → Secrets and variables → Actions**.

Upload the build first. The shared upload script is on [API pull request testing](https://docs.qa.tech/pr-testing/api.md#upload-the-pr-build).

### Run a change review on the PR

Use this when you want the review agent to select tests from the diff and post a native GitHub review. Install the GitHub App at the organization level with access to the repository. Turn off **Auto-run on PRs** for that repo in **Settings → Integrations → GitHub App** so QA.tech does not also start a review against the default environment.

```yaml theme={null}
name: QA.tech mobile change review
on:
  pull_request:

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build APK
        run: ./gradlew assembleDebug

      - name: Upload build to QA.tech
        id: upload
        env:
          QATECH_API_TOKEN: ${{ secrets.QATECH_API_TOKEN }}
          APK_PATH: app/build/outputs/apk/debug/app-debug.apk
        run: |
          APP_ID="app_gXeBl2"
          FILE_NAME=$(basename "$APK_PATH")
          UPLOAD_RESPONSE=$(curl -sSf -X POST "https://api.qa.tech/v1/applications/$APP_ID/builds/upload-url" \
            -H "Authorization: Bearer $QATECH_API_TOKEN" \
            -H "Content-Type: application/json" \
            -d "{\"fileName\": \"$FILE_NAME\"}")
          UPLOAD_URL=$(echo "$UPLOAD_RESPONSE" | jq -r '.uploadUrl')
          BUILD_TOKEN=$(echo "$UPLOAD_RESPONSE" | jq -r '.buildToken')
          curl -sSf -X PUT "$UPLOAD_URL" \
            --upload-file "$APK_PATH" \
            -H "Content-Type: application/octet-stream"
          BUILD_RESPONSE=$(curl -sSf -X POST "https://api.qa.tech/v1/applications/$APP_ID/builds" \
            -H "Authorization: Bearer $QATECH_API_TOKEN" \
            -H "Content-Type: application/json" \
            -d "{\"platform\": \"android\", \"buildToken\": \"$BUILD_TOKEN\"}")
          echo "build_short_id=$(echo "$BUILD_RESPONSE" | jq -r '.applicationBuildShortId')" >> "$GITHUB_OUTPUT"

      - uses: QAdottech/run-action/change-review@v4
        with:
          project_short_id: 'proj_abc123'
          api_token: ${{ secrets.QATECH_API_TOKEN }}
          applications_config: |
            {
              "applications": {
                "app_gXeBl2": {
                  "environment": {
                    "applicationBuildShortId": "${{ steps.upload.outputs.build_short_id }}"
                  }
                }
              }
            }
```

Without the GitHub App, the action can create a chat but never comment on the PR. Install it at the organization level with access to the repository.

The Change Review Action reads the PR URL from `github.event.pull_request.html_url` on `pull_request` events. Set `blocking: true` if the job should wait for the verdict. Inputs and outputs are in [Change Review Action reference](#change-review-action-reference).

Write a PR description that names the user-facing flows to test. The agent uses that context the same way it does for web PRs. See [PR Testing](https://docs.qa.tech/best-practices/pr-testing.md).

To run a known test plan against the same build, see [GitHub regression testing](https://docs.qa.tech/regression-testing/github.md#test-a-mobile-pull-request-build).

## Common questions

**Can I control which tests run?**

The GitHub App selects tests on its own. Steer a run by commenting `@qa.tech <instructions>` on the pull request, for example `@qa.tech test the checkout flow`. See [Triggering a PR Review](#triggering-a-pr-review). To choose the tests yourself, run a test plan with [GitHub regression testing](https://docs.qa.tech/regression-testing/github.md). You can use both.

**How do I trigger or re-run a review manually?**

Comment `@qa.tech` on the pull request. Add instructions to focus the review, or a preview URL to test a specific environment (`@qa.tech https://preview.example.com`). You can also use GitHub's **Re-run** button on the QA.tech check.

**My project has more than one application per pull request. What can I do?**

Keep the GitHub App installed, turn off **Auto-run on PRs** in **Settings → Integrations → GitHub App**, and start reviews from the [Change Review Action](#change-review-action). Pass one `applications_config` entry per application so each one gets its own preview URL. With auto-run off, the **QA.tech / PR Review** check appears when the action runs.

**Can I gate reviews on labels, paths, or a specific deploy job?**

Yes. Use the [Change Review Action](#change-review-action) and put the gating in your workflow (`if:` on labels or paths, `needs:` on a deploy job). Turn off **Auto-run on PRs** if only the action should start reviews.

**How do I review a native iOS or Android app?**

Automatic App reviews look for a preview URL. A mobile pull request is a new binary. Upload the build from CI and pin the review to it. See [Mobile build](#mobile-build). Turn off **Auto-run on PRs** for that repository so the App does not also review the default build.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.