Before you begin
Before you begin
- Access to edit the resource and use your Checkly account’s GitHub integration.
- A local checkout of the repository and the CLI prerequisites, including a Node.js version supported by your Checkly version.
- The GitHub CLI for the checkout command below. You can also use GitHub’s PR checkout instructions.
1. Connect GitHub and choose a repository
Open the resource’s Export to code dialog and select Code. If prompted, connect GitHub from Checkly and grant the App access to your repository. See GitHub integration setup for installation help; you don’t need a deployment hook for this workflow. For a UI-created resource, choose the repository to export into. If it has multiple Checkly configs, select the folder for your project. Checkly can add the resource to a project already deployed to this account or create a config for a new project. For a code-managed resource, Checkly uses its project’s repository. If asked, choose the file that declares the resource.2. Open the PR
- UI-created resource: click Export to code. Checkly generates the code and temporarily reserves the existing resource for the project. Your monitoring keeps running; ownership stays pending until you deploy.
- Code-managed resource: save your UI changes, then click Sync to code to send them to its source file. Already in Sync means there’s nothing to send.
3. Check out the PR and install dependencies
From your local repository checkout, select the PR:Terminal
checkly.config.ts or checkly.config.js. In a monorepo, use the package or workspace containing that config.
These examples use npm; use your repository’s package manager. Install the project dependencies:
Terminal
Terminal
package.json, follow CLI installation.
For pnpm, use pnpm add --save-dev checkly and pnpm exec checkly; for Yarn, use yarn add --dev checkly and yarn checkly.
4. Sign in and test the changes
Select the Checkly account that owns the resource:Terminal
CHECKLY_API_KEY and CHECKLY_ACCOUNT_ID, run whoami to confirm the account. See CLI authentication for setup.
Review the files before testing:
- Keep the project’s
logicalIdand generated construct IDs unchanged so the code updates the existing resources. - Check that your config’s file patterns load the exported constructs.
- Supply the required environment variables and secrets locally and in CI. Exported credentials can be blank or read from environment variables. Deploying a blank credential can overwrite its value in Checkly.
Terminal
Terminal
5. Review and merge
Review the diff and test results, then merge the PR on GitHub. Merging saves the code to your repository; deployment applies it to Checkly. To make another change or abandon the PR, see Update, close, or reopen a PR.6. Deploy the merged code
Switch to the branch the PR was merged into. From the folder containing the Checkly config, pull the changes, install dependencies, and preview the deployment:Terminal
Terminal
npx checkly deploy --force for CI. See CI/CD setup.
For a UI export, a successful deployment containing all the exported declarations completes the export automatically, preserving resource IDs and history. You don’t run checkly import, import apply, or import commit. Tests, previews, and merging leave ownership pending, as does a deployment that omits a required declaration. If deployment fails, ownership stays pending. While pending, deployments that omit the reserved resource can’t delete it.
Once code manages the resource, later deployments overwrite UI edits and delete resources removed from code. Use --preserve-resources to keep removed resources and their history.
7. Check the result in Checkly
- The project’s deployment history shows Succeeded. Check its commit information, when available, to confirm the merged revision.
- An exported resource shows Managed by your project instead of Importing into, with the same ID and history.
- The tracked PR shows Deployed. For a sync PR, the Merged · awaiting deploy badge clears after deployment.
Update, close, or reopen a PR
Update in code: edit the PR branch, commit and push your changes, then rerun tests. Update from Checkly: save the resource again, then use Update PR or Sync to code. Before syncing a code-managed resource, keep a copy of any branch edits you need: Checkly rebuilds the branch from the default branch and can replace those edits. A pending export preserves other files but rewrites its generated resource files. Review the updated diff and rerun tests. Close: close the PR on GitHub. Before ownership is finalized, Checkly releases the reservation when it processes the close, unless another live PR still uses it. The resource keeps running. Closing a sync PR doesn’t undo your UI edit. Reopen: reopen it on GitHub. Checkly tries to reserve the original identities again. If another project or import has taken them, resolve that conflict and export again. You can’t reopen a merged PR. Deploy after merging. If you deploy the PR branch before merging, closing the PR won’t undo ownership or deployed changes.Use the CLI to import resources
The dialog’s CLI tab supplies a command to generate code locally. You create the branch and PR yourself. Manual import usesnpx checkly import, then npx checkly import apply, then npx checkly import commit. The interactive prompts can also apply and commit the plan.
Deployment doesn’t automatically commit a manual import. import commit changes ownership in Checkly and is separate from a Git commit. Follow Importing resources from the UI for the full workflow.
Deploying manual import code before applying its plan creates duplicates. You can cancel an uncommitted plan with npx checkly import cancel, but cancellation doesn’t undo changes already deployed.