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

> ## Agent Instructions
> Spur is an AI-powered QA engineer that lets teams create and run automated end-to-end tests for web and mobile apps using natural language.
> When answering questions about Spur, cite the relevant page from docs.spurtest.com.

# CI/CD

> Automatically run your Spur test plans on every pull request and block deployments when tests fail.

## Overview

Connecting Spur to your CI/CD pipeline adds an automated quality gate right before deployment. When a pull request is opened or code is pushed, Spur triggers your test plans and reports results directly in your repository. Failing tests block a merge before anything reaches production.

> [card] [GitHub](https://docs.spurtest.com/running-tests/cicd/github.md)
>
> Set up GitHub Actions to run test plans on every pull request.

> [card] [GitLab](https://docs.spurtest.com/running-tests/cicd/gitlab.md)
>
> Set up GitLab CI/CD to run test plans on every merge request.

> [card] [Override URLs](https://docs.spurtest.com/running-tests/cicd/override-urls.md)
>
> Redirect tests to deploy previews or feature branch URLs at runtime.

## Triggering via webhook

As an alternative to the GitHub Actions or GitLab pipeline files, you can trigger Spur test plans directly using a curl request to the Spur webhook. This is useful if you use a CI/CD provider other than GitHub or GitLab, or if you want more control over when tests are triggered.

Send a POST request to the Spur webhook endpoint with your API key, the commit SHA, and the repository in `owner/repo` format. You can find your API key on the GitHub Integration Settings page in Spur. All three headers are required:

```bash theme={null}
curl -X POST \
  -H "Content-Type: application/json" \
  -H "spur-github-key: <YOUR_API_KEY>" \
  -H "sha: <COMMIT_SHA>" \
  -H "repo: <OWNER>/<REPO>" \
  -d '{
    "override_urls": {
      "default": "https://my-app-pr-42.vercel.app"
    }
  }' \
  "https://app.spurtest.com/api/webhook/github"
```

The `override_urls` body is optional. Include it to redirect tests to a different URL (such as a deploy preview) without changing your environment settings. See [Override URLs](https://docs.spurtest.com/running-tests/cicd/override-urls.md) for the full configuration options.

> [!TIP]
>
> You can use this webhook in any CI/CD system, including Jenkins, CircleCI, Bitbucket Pipelines, or custom deployment scripts.

## Running specific test plans

By default, the webhook runs every test plan enabled on the GitHub Integration Settings page. To run only some of them, add the `test_plan_ids` query parameter to the webhook URL. Separate multiple IDs with commas. A test plan's ID is the number at the end of its URL in Spur, for example `app.spurtest.com/test-plans/789`:

```bash theme={null}
curl -X POST \
  -H "Content-Type: application/json" \
  -H "spur-github-key: <YOUR_API_KEY>" \
  -H "sha: <COMMIT_SHA>" \
  -H "repo: <OWNER>/<REPO>" \
  "https://app.spurtest.com/api/webhook/github?test_plan_ids=789,790"
```

Use this to run a different test plan from each workflow. For example, you can run a staging plan on pull requests to `develop` and a UAT plan on pull requests to `staging`.

> [!NOTE]
>
> The parameter name is plural: `test_plan_ids`. Spur ignores `test_plan_id` and runs every enabled test plan.
>
> Spur runs only the listed test plans that are enabled for the integration. If none of the IDs is enabled, no run starts, and the webhook still returns a success response. If an ID is not a whole number, Spur rejects the request with `Invalid test plan ids` and starts no run.


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