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

# CircleCI

> Report a deploy to QA Wolf from a CircleCI job, or have the job create the deployment your code host already understands.

A CircleCI pipeline tells QA Wolf about a deploy in one of two ways. Both are supported, and which one fits depends on where your repository lives.

## Report the deploy from CircleCI

The direct route: a job that runs after your deploy succeeds and reports it to QA Wolf. This works whatever your code host is.

Add `QAWOLF_API_KEY` and `QAWOLF_WORKSPACE_ID` under **Project Settings → Environment Variables**, then add the job to `.circleci/config.yml`.

Example:

```yaml theme={null}
jobs:
  notify-qa-wolf:
    docker:
      - image: cimg/base:current
    steps:
      - run:
          name: Report the deploy to QA Wolf
          command: |
            curl -X POST "https://app.qawolf.com/api/trpc/public.deployment.reportStatus" \
              -H "Authorization: Bearer $QAWOLF_API_KEY" \
              -H "Content-Type: application/json" \
              -d "{
                \"json\": {
                  \"workspaceId\": \"$QAWOLF_WORKSPACE_ID\",
                  \"providerDeploymentId\": \"$CIRCLE_WORKFLOW_ID\",
                  \"status\": \"success\",
                  \"environment\": { \"name\": \"staging\" },
                  \"deployTarget\": \"https://staging.example.com\",
                  \"metadata\": {
                    \"commitSha\": \"$CIRCLE_SHA1\",
                    \"ref\": \"$CIRCLE_BRANCH\",
                    \"repository\": \"$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME\"
                  }
                }
              }"

workflows:
  build-deploy-test:
    jobs:
      - notify-qa-wolf:
          requires:
            - deploy
```

`CIRCLE_WORKFLOW_ID` is stable for one workflow run, so a retried job reports the same deployment rather than a second one. [Webhook](/deployment-testing/webhook) documents every field the report carries.

## Let your code host record the deploy instead

If your repository is on GitHub or GitLab, a CircleCI job can create the code host's own deployment, and QA Wolf picks it up through the connected integration. Nothing in the job talks to QA Wolf at all.

* **GitHub** — the job calls [`POST /repos/{owner}/{repo}/deployments`](https://docs.github.com/en/rest/deployments/deployments) with the `ref` it deployed, then marks the result with a [deployment status](https://docs.github.com/en/rest/deployments/statuses).
* **GitLab** — CircleCI is not running the pipeline GitLab records deployments from, so the deploy has to move into a GitLab [deployment job](https://docs.gitlab.com/ci/environments/) for this route to apply. Otherwise report it from CircleCI as above.

The code-host route is worth the extra step when you want the deploy visible in your code host as well, and when you want QA Wolf to resolve the pull request from the commit rather than from what the job declares. See [GitHub deployments](/deployment-testing/github) and [GitLab deployments](/deployment-testing/gitlab).

## Create a trigger

Either route produces a deployment. A [trigger](/triggers/overview) is what turns it into a run — see [Set up a trigger](/triggers/set-up-a-trigger).
