> ## 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.

# Integrate with the QA Wolf CI SDK

> Trigger QA Wolf test runs from any CI system that supports Node.js.

Use this guide if your CI system supports Node.js. If it can't run Node.js, use [Webhook](/webhook-integration) instead.

## Requirements

* Access to a QA Wolf workspace with at least one environment configured
* Node.js 18 or later in your CI environment
* Admin access to your CI system's secret or environment variable storage

## How to connect QA Wolf to your CI system

<Steps>
  <Step title="Add the QAWOLF_API_KEY secret">
    Store your QA Wolf API key as a secret named `QAWOLF_API_KEY` in your CI system.
  </Step>

  <Step title="Add the notify script to your repository">
    Create `.ci/notifyQaWolf.mjs` in the repository that corresponds to the deployments QA Wolf will be testing.

    ```javascript expandable theme={null}
    import assert from "assert";
    import { makeQaWolfSdk } from "@qawolf/ci-sdk";

    const apiKey = process.env.QAWOLF_API_KEY;
    assert(apiKey, "QAWOLF_API_KEY is required");

    const sha = process.env.GIT_COMMIT_SHA;
    assert(sha, "GIT_COMMIT_SHA is required");

    const branch = process.env.GIT_BRANCH;
    assert(branch, "GIT_BRANCH is required");

    const { attemptNotifyDeploy } = makeQaWolfSdk({ apiKey });

    const result = await attemptNotifyDeploy({
      branch,
      sha,
      deploymentType: "staging",
      hostingService: "GitHub", // or "GitLab"
      repository: {
        name: "your-repo-name",
        owner: "your-org-name",
      },
    });

    if (result.outcome !== "success") {
      throw new Error(`Failed to notify QA Wolf: ${JSON.stringify(result)}`);
    }
    ```

    Replace `GIT_COMMIT_SHA` and `GIT_BRANCH` with the variable names your CI system provides for the current commit SHA and branch, and `deploymentType` with the value your QA Wolf representative provides. Set `hostingService` to where your code is hosted, not where your pipeline runs.
  </Step>

  <Step title="Run the notify script in your pipeline">
    Add a step that runs after your deployment is healthy.

    ```bash theme={null}
    npm install @qawolf/ci-sdk
    node .ci/notifyQaWolf.mjs
    ```
  </Step>

  <Step title="Verify the integration">
    Trigger your CI pipeline with a new deployment. Confirm the notify step completes without errors, and that a new run appears in QA Wolf under the expected environment.
  </Step>
</Steps>

## Related

* [`@qawolf/ci-sdk`](/libraries/ci-sdk/api-reference)
