@qawolf/ci-sdk is a TypeScript package for notifying QA Wolf of a deploy from your CI pipeline and gating the pipeline on the result. It calls the same public API the Webhook page documents, with typed inputs taken from the published API contract.
SDK functions do not throw. Each returns a result object with an outcome field, and your pipeline branches on it to decide whether the step passes or fails.
The guide for wiring it into a pipeline is Node.js SDK. This page is the function-by-function reference.
This page documents 3.6.0. deployment.reportStatus needs 3.1.0 or later, so a pipeline on an earlier version has only the legacy functions and upgrades before wiring one up. Use 3.6.0 or later for deployment.waitForVerdict: earlier versions fail on every call (before 3.4.1), fail while a run is still executing (before 3.5.1), or keep waiting until timeout on a run that needs a person (before 3.6.0).
Installation
Requires Node.js 24.14.1 or later, below 25. The package is published as ESM only: import it with
import, or from CommonJS with await import("@qawolf/ci-sdk"). require("@qawolf/ci-sdk") does not resolve.makeQaWolfSdk
The entry point for every function. Pass your API key to initialize.Options
A second argument injects dependencies. Each is optional:
Returns an object with these functions:
deployment.reportStatus— reports a deployment. A deployment’s firstsuccessreport is what evaluates loops and starts a run.deployment.collectDeployChanges— builds a deployment’schangesfrom the deploy’s commits, carrying ids, with secrets redacted.deployment.findLastDeployedCommit— reads the commit of an environment’s last successful deploy.deployment.collectCommitChanges— builds a deployment’schangesfrom the commits after a given one, without ids or redaction.codeHostIntegration.findForRepository— checks what QA Wolf reads of a repository.deployment.waitForVerdict— blocks until QA Wolf can say whether the deployment’s tests passed.environment.promoteandenvironment.terminate— close a preview environment, keeping or discarding its flow changes.promotion.get— reads how a promotion settled.uploadBuild— uploads an Android or iOS app build.generateSignedUrlForRunInputsExecutablesStorageandgenerateSignedUrlForTempTeamStorage— signed upload URLs for files a run needs.notifyTerminatedEphemeralEnvironment— deprecated; performs a promote through the legacy webhook.attemptNotifyDeploy,pollCiGreenlightStatusandmakePollCiGreenlightStatusIterator— the legacy functions. They report through thedeploy_successwebhook, which loops do not see.
detectProviderDeploymentId is a standalone export rather than a method; see below.
API keys and workspaceId
Every call acts on exactly one workspace.
- A workspace API key belongs to one workspace.
deployment.reportStatusstill requiresworkspaceId, and it has to name that workspace; naming another fails withunauthorized. - An organization API key or a user API key can reach several workspaces, so
workspaceIdpicks one.
workspaceId as an optional field; see each function for what happens when it is omitted.
deployment.reportStatus
Reports a deployment to QA Wolf through the publicdeployment.reportStatus API. The parameters are the API’s own input, so Webhook and Deployments describe how each field is read.
Example:
Parameters
The input is validated strictly: a field the contract does not know, or
environment carrying both id and name, is an invalid-request. ReportDeploymentParams is the exported type.
Result
Branch onoutcome:
The response carries the deployment only, never the resulting runs.
deployment.waitForVerdict is how a pipeline learns what the runs decided.
outcome: "reported" means QA Wolf recorded the deployment, not that a loop matched it. Whether a run starts is decided afterwards, by your loops.deployment.collectDeployChanges
Builds thechanges value for deployment.reportStatus from the deploy’s commits in the local git history. It sends nothing itself, so you pass what it returns to deployment.reportStatus. Requires 3.8.0. Starting from the last deployed commit, with environment in place of since, requires 3.10.0 and @qawolf/api-contracts 0.155.0.
Example:
(#N) is a squashed pull request, and on Azure Repos, so is a commit whose subject is Merged PR N: <title>. Each change carries its ids, a pull request’s number and the commit it landed as, or a commit’s sha, so QA Wolf lists a change it also reads from your code host only once. It never reads diffs or file contents.
Before it returns the changes, it redacts secrets from the text, such as tokens, keys, and passwords, with the same patterns QA Wolf applies when it receives them. It also removes trailers like Co-authored-by: that name a person by email, and leaves out any change QA Wolf wouldn’t accept.
On a shallow clone, or when since names no commit, it returns collected with no changes and says what went wrong in changes.problems, so QA Wolf can raise a setup problem. The log says how to fix it.
Parameters
When the filter throws, takes longer than
filterTimeoutMs, or returns something that isn’t a list of changes, none of the changes are sent, never the text as it was before the filter, and changes.problems says the filter failed. A returned change QA Wolf doesn’t accept, such as one without a title, is left out, and changes.problems says the filter failed too.
Pull request lookup
When QA Wolf doesn’t read your repository’s pull requests itself,pullRequests.token lets the SDK look up the merged pull request behind each commit, so it’s sent with its number, title, description, and changed file paths. Pass GITHUB_TOKEN on GitHub Actions, with pull-requests: read permission, or System.AccessToken on Azure Pipelines.
- Where the token goes. Only to your CI’s own code host: on GitHub Actions, the GitHub server the job runs for; on Azure Pipelines, the Azure Repos repository the job was started for; elsewhere, only to api.github.com for a repository on github.com. It’s sent only over https, never follows a redirect, and is never sent to QA Wolf or printed. GitLab and Bitbucket aren’t supported.
- GitHub Enterprise Server on another CI. Pass the server’s API as
codeHost: { kind: "github", apiUrl: "https://github.example.com/api/v3" }.apiUrlmust be https and on the repository’s own host. - Limits. At most the 50 newest commits are looked up. A permission error, a rate limit, or a failed request stops the lookups, and the commits without a pull request are sent as commits.
- When QA Wolf reads the pull requests itself, through its GitHub or GitLab integration, nothing is looked up. Without a token, the commits are sent as they are.
Result
Every result carriescoverage, what QA Wolf said it reads of the repository, and repository, the URL it checked and where the URL came from. See codeHostIntegration.findForRepository. Branch on outcome:
More outcomes and reasons may be added in minor versions.
deployment.findLastDeployedCommit
Asks QA Wolf for the commit of the environment’s last successful deploy, a hint for where to start collecting changes.deployment.collectDeployChanges calls it for you when you pass environment without since. Requires 3.10.0 and @qawolf/api-contracts 0.155.0.
Example:
Parameters
Result
It can also return one of the usual failures, such as
not-found for an environment id that doesn’t exist. More outcomes may be added in minor versions.
codeHostIntegration.findForRepository
Works out the job’s repository and asks QA Wolf what it reads there through the workspace’s code host integrations. It takes the samerepository, workspaceId, cwd, and env options as deployment.collectDeployChanges, and never fails. Requires 3.8.0.
Example:
coverage.status is one of:
More values may be added in minor versions. Treat one you don’t handle like
unknown.
deployment.collectCommitChanges
Builds thechanges value for deployment.reportStatus from the local git history, from the commit after since up to HEAD. It returns the summary rather than sending it, so you can check or edit it first. Requires 3.7.0; earlier versions call it collectChanges.
Example:
(#123), becomes a pull request titled from its message. Any other commit stays a commit. It reads commit messages and, when asked, changed file paths. It never reads diffs or file contents.
It reads at most the 250 newest commits. Older ones, and any left out to fit the API’s limits, are counted in omittedCount.
Parameters
Result
Branch onoutcome:
detectProviderDeploymentId
Composes aproviderDeploymentId from the variables your CI system already sets. The id is distinct for every job definition and every re-run, so a retried job or a second job deploying alongside the first gets its own deployment rather than reporting into one whose first success already evaluated loops.
Example:
Options
Result
The helper is optional.
providerDeploymentId is always required on the report, and any value that changes on every re-run and differs between concurrent deploys works.
deployment.waitForVerdict
Blocks until QA Wolf can say whether a deployment’s tests passed. Give it thedeployment.id the report returned; resolving that to the runs the loops created, and those runs to a status, happens inside.
On GitHub Actions, qawolf/wait-for-verdict-action runs this wait as a workflow step. See GitHub Actions.
Example:
Options
Every field exceptdeploymentId is optional. Durations are in milliseconds.
The stages
onProgress receives, in order:
waiting-for-evaluation— QA Wolf has not yet evaluated the deployment’s loops.waiting-for-run— loops matched and at least one is still creating a run. CarriesmatchedTriggerCount.waiting-for-verdict— every run is known and at least one is still executing. Carriesruns.
Result
Branch onoutcome:
not-tested is a separate answer from passed. A deployment no loop matched was not tested, which is a different fact from tests passing, and your pipeline decides what it is worth. reason is "no-trigger-matched" when every loop was evaluated and none matched, or "no-run-created" when a loop matched and something stopped it from creating a run; each entry in triggers then carries triggerName, a message for the log and, for no-run-created, a stable reason code to branch on.
needs-review means a person must answer before QA Wolf can decide: QA Wolf does not call a run passed or failed while a failure still waits for a diagnosis. The wait returns as soon as only a person can move the run, either because QA Wolf asked a question about each failure without a diagnosis or because the workspace does not investigate runs. Each run’s runUrl takes your build log to the run page, where someone answers the questions. After that the run settles to passed or failed. The example above exits 1 on it.
superseded is what a cancel-in-progress pipeline looks like from the older job: the newer deployment’s job carries the verdict. Reserve a distinct exit code for it when your CI should treat the job as skipped rather than failed.
Each entry in runs:
DeploymentVerdict, VerdictRun, VerdictStage, TriggerNote and NotTestedReason are the exported types. The same shape is published as deploymentVerdictSchema in @qawolf/api-contracts.
environment.promote and environment.terminate
Close a preview environment thatdeployment.reportStatus created, once its pull request is done. The two are not interchangeable:
environment.promote— the work was accepted, typically on merge. The environment’s flow changes are merged into its base environment, and the environment is terminated once they land.environment.terminate— the work was abandoned, typically on a close without merge. The flow changes are discarded and the environment’s runs are canceled.
Parameters
Result
environment.promote answers "requested" with promotion, in pending, because the merge runs in the background; read how it settled with promotion.get, below. environment.terminate answers "terminated" with environment, whose terminatedAt is set. Both share these refusals:
Calling
environment.promote again while a promotion is open returns that same promotion rather than opening a second one. An environment whose promotion is still being applied cannot be terminated until it settles; one whose promotion is conflicted can.
promotion.get
Reads how a promotion thatenvironment.promote requested settled.
Example:
promotion.status is one of:
pendingandresolving— not settled yet. Poll again.promoted— the flow changes landed in the base environment. CarriespromotedCommitHash.no-changes— there was nothing to merge.conflicted— the flow changes clash with the base environment.conflict.pathsnames the files. A person resolves it in QA Wolf, and the environment stays until they do.abandoned— the environment was terminated before the promotion settled.
conflict is present while the status is conflicted or resolving, and settledAt once it is promoted, no-changes or abandoned. Refusals are the same as for environment.promote, with not-found meaning no promotion matches promotionId.
A promotion usually settles within a minute or two. The SDK has no wait helper for it, so a pipeline that needs the settled status polls promotion.get while it reads pending or resolving.
uploadBuild
Uploads an Android.apk or .aab, or an iOS .ipa, of up to 1 GB, and registers it as a QA Wolf build. QA Wolf reads the app id, version and build number from the file. The file is streamed from disk, so a large build is not held in memory.
Example:
Parameters
Result
"uploaded" carries build with id, appId, appName, platform, version, buildNumber, fileName, sizeBytes and url. Otherwise:
A failed call creates no build. Each call uploads the file as a new build, so retrying is calling
uploadBuild again.
To start runs that install the build, pass result.build.id to deployment.reportStatus as builds. See Upload builds.
notifyTerminatedEphemeralEnvironment
Tells QA Wolf that an ephemeral environment has been terminated. QA Wolf stops the runs targeting it and promotes any flow changes to the base environment. See webhooks/environment_terminated for the underlying endpoint. With a connected GitHub or GitLab integration, QA Wolf hears about the pull request closing from the code host, and this call is redundant. Example:Input fields
Pass exactly one of the following to identify the environment:environmentAlias and deploymentUrl also take workspaceId. It is optional; an organization or user key that omits it acts on the organization’s first-created workspace, and the result carries a warning naming it. NotifyTerminatedEphemeralEnvironmentInput is the exported type.
Result fields
generateSignedUrlForRunInputsExecutablesStorage
Generates a signed URL for uploading a run input executable (APK, AAB, DEB, IPA, ZIP, CSV, PDF) to QA Wolf. See v0/run-inputs-executables-signed-urls for the underlying endpoint, and Legacy build uploads for the pipeline it belongs to. To upload an Android or iOS build, useuploadBuild.
Example:
Input fields
Response fields
A failed request from this function reports
abortReason: "client-network-error" and httpStatus: 0 whatever the real status was. The SDK logs the real status on the line above, so read the log rather than branching on abortReason. A 400 from an organization or user key most often means workspaceId was not sent.generateSignedUrlForTempTeamStorage takes the same input and returns the same fields, for files that are not executables.
Legacy functions
Moving a pipeline off them:deploymentType becomes environment.name; branch and sha move into metadata; providerDeploymentId is new and required, and subsumes deduplicationKey; hostingService disappears, since the code host comes from your integration; variables becomes environmentVariables. There is no skipped outcome, because whether a loop matched is not known at report time; deployment.waitForVerdict answers not-tested instead.
attemptNotifyDeploy
Notifies QA Wolf of a successful deployment through webhooks/deploy_success. Example:DeployConfig fields
DeployConfig is a union of GitHubDeployConfig, GitLabDeployConfig and EphemeralDeployConfig. Every field is declared on the type, so pass undefined for the ones you do not use.
Result fields
pollCiGreenlightStatus
Polls v0/ci-greenlight for a run id until the run completes. The run id comes fromattemptNotifyDeploy, so this function only works for pipelines on the legacy path.
Example:
Options
Result fields
makePollCiGreenlightStatusIterator
An async generator over the same poll, for a pipeline that needs to stop early on its own criteria. Takes the same options aspollCiGreenlightStatus except onRunStageChanged.
Example:
Versioning
The package follows SemVer.- Depend on it with the
^range operator. Patch and minor releases do not introduce breaking changes. - A major version bump marks a breaking change, announced in advance.
- Only top-level exports are covered. New fields in response types, and changes to log output, are not breaking changes.
The changelog is in the package’s README on npm.