Skip to main content

Trigger from CI

Heal can be triggered from CI or from any automation.

tip

You can also setup your CI pipeline to run Heal on schedule.

Most users setup heal as an async step in CI, that triggers when merging on staging/pre-prod. Jobs are set as async checks in CI, and post a notification in slack or discord.

It's also possible to setup heal to run on every PR (optionally as a blocking step), pointing tests to an ephemeral (eg. Vercel or Netlify preview). This is the setup we have at heal.

warning

If you want to make your heal tests bocking in your CI pipeline, make sure you keep your tests short so that they execute fast enough.

Generating an API key

You can create an API key from the Organisation/keys menu.

GitHub action

You can use this GitHub action to setup Heal on GitHub. Reach out to us on twitter if you need help setting it up (or for other environments).

name: Heal.dev CI
on:
push:

jobs:
heal-dev:
name: Heal.dev
runs-on: ubuntu-latest
steps:
- name: Trigger Heal Suite Execution
uses: heal-dev/trigger@v1
with:
api-token: ${{ secrets.HEAL_API_TOKEN }} # Required: Your Heal API token.
suite: "project-test/suite-test" # Required: The slug of the project and suite `project-slug-name/suite-slug-name`.
wait-for-results: "yes" # Optional: Wait for results (default: 'yes').
comment-on-pr: "yes" # Optional: Whether to comment test results on PRs (default: 'no').

Targeting Vercel preview environments

Vercel's GitHub action changes the GitHub deployment_status to success when it is ready. When that happens, the deployment URL will be available in github.event.deployment_status.target_url.

This can used to trigger a run pointing to a Vercel ephemeral.

on: deployment_status

jobs:
heal-dev:
if: ${{ github.event.deployment_status.state == 'success' }}
name: Heal.dev
runs-on: ubuntu-latest
steps:
- uses: heal-dev/trigger
with:
api-token: ${{ secrets.HEAL_API_TOKEN }} # Required: Your Heal API token.
suite: "projectSlug/suiteSlug" # Required: The ID of the test suite.
stories: |
[
{
"slug": "story-slug", # Slug of the story to run.
"test-config": # Custom test configuration for this story.
{
"entrypoint": "${{ github.event.deployment_status.target_url }}", # Override entrypoint
}
}
]

Refer to the GitHub action docs for more.

This will work for any deployment pipeline that provides a deployment_status and a github.event.deployment_status.target_url

Other CI

To trigger runs on other CI, you should refer to Heal.dev API