Prerequisites
Prerequisites
- A GitHub repository with GitHub Actions enabled.
- A Checkly project that uses Checkly CLI
8.15.0or newer. CHECKLY_API_KEYstored as a GitHub Actions secret.CHECKLY_ACCOUNT_IDstored as a GitHub Actions variable. Account IDs do not need to be secrets.- For detached GitHub Check reporting, the Checkly GitHub App connected to the same Checkly account and granted access to the repository.
Run checks on pull requests
Use this workflow when your Checkly constructs are defined in the repository:.github/workflows/checkly.yml
reporting: auto, the Action uses a detached GitHub Check when it is available. Otherwise, the workflow waits for the test session and reports the result through the GitHub Actions job.
Choose what to run
Thecommand input selects the source of the checks:
For
test, use tags, grep, or files to select repository constructs:
tags line creates a separate --tags filter. Comma-separated tags on one line must all match.
For trigger, select deployed checks with tags or check IDs:
.github/workflows/checkly-trigger.yml
Choose a reporting mode
Thereporting input controls whether the workflow waits for the Checkly test session:
Detached reporting produces two separate GitHub Check Runs: the GitHub Actions job and the external Checkly GitHub Check. The workflow job can finish successfully after starting the detached test session while the external Checkly GitHub Check is still running.
Use
github-check-name to set the external GitHub Check Run name. It defaults to Checkly; it is not the name of a Checkly check.
A GitHub Actions job Check Run, an external Checkly GitHub Check Run, and a Checkly check are different objects. The Action does not publish a legacy commit status. The Checkly test session contains the execution results behind either reporting mode.
Resolve the CLI and dependencies
The Action requires Checkly CLI8.15.0 or newer. Use cli-version: latest unless you need to test against a specific stable release.
The Action resolves the CLI after running install-command inside working-directory:
- If the project installs the
checklypackage, the Action uses that local CLI so the CLI and imported constructs share the same module installation. - Otherwise, the Action runs
npx checkly@<cli-version>.
checkly dependency at 8.15.0 or newer. If you use an exact stable cli-version, it must match the locally installed Checkly version.
In a monorepo, working-directory selects where the Action resolves the config, dependencies, and CLI. When dependencies install from the repository root, install them before invoking the Action:
.github/workflows/checkly-monorepo.yml
install-command instead. The command runs inside working-directory before the Action resolves the local CLI.
Report to the correct commit
GitHub Check Runs attach to commits. By default, the Action uses:
Set
github-sha when the commit you check out and test differs from that default. This commonly applies to repository_dispatch and deployment workflows. Use the same SHA for checkout and Check reporting:
.github/workflows/checkly-preview-dispatch.yml
github-sha only selects the commit that receives the external Check; it does not grant repository access. Checkly still verifies that the GitHub App installation for the Checkly account can access the repository.
Test preview deployments
Pull request and custom-dispatch workflows usually need to pass their preview URL explicitly asENVIRONMENT_URL, as shown in the repository_dispatch example above.
For deployment_status events, the Action automatically exposes github.event.deployment_status.environment_url as ENVIRONMENT_URL when the workflow has not already set it. GitHub sets GITHUB_SHA to the commit being deployed, so the Action can normally use its default commit metadata:
.github/workflows/checkly-deployment.yml
GITHUB_SHA, pass that same commit through github-sha.
If you want Checkly itself to listen for GitHub deployment events and trigger checks linked to a repository, use GitHub deployment hooks instead of this workflow.
Protect merges with detached checks
Configure the exactgithub-check-name as a required check.
If the workflow uses path filters, make sure it still creates the required Checkly Check for every pull request commit. Prefer Action inputs such as files, grep, or tags when you need to select a smaller test set.
Next steps
- Learn more about
checkly test. - Learn more about
checkly trigger. - Use GitHub deployment hooks when you want Checkly to react directly to GitHub deployment events.