Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
---
category: Guides
title: How to Run Synthetic Tests in GitHub Actions
description: Integrate openstatus synthetic monitoring into your CI/CD pipeline
sidebar:
label: GitHub Action for Synthetics
---
## Problem
You want to validate that your application's critical endpoints are working before deploying to production. Running synthetic tests in your CI/CD pipeline catches issues early and prevents broken deployments.
## Solution
openstatus provides a GitHub Action that runs your configured monitors as part of your CI/CD workflow. This guide shows you how to set it up.
## Prerequisites
- An [openstatus](https://www.openstatus.dev) account
- A GitHub repository
- At least one monitor configured in openstatus
- Admin access to your GitHub repository (for secrets)
## Step-by-step guide
### 1. Create a configuration file
Create a file named `openstatus.config.yaml` in your repository root:
```yaml
tests:
ids:
- 1
- 2
```
**Finding monitor IDs:**
1. Go to your openstatus dashboard.
2. Click on a monitor.
3. The ID is in the URL: `https://app.openstatus.dev/monitors/[ID]`.
**Tip:** start with your most critical monitors and expand from there.
### 2. Get your openstatus API key
1. Go to **Settings → General** in your openstatus dashboard
2. Find the **API Keys** card
3. Click **Create** and copy the key — you won't see it again after closing the dialog
4. Store it securely - you'll need it for the next step
### 3. Add your API key to GitHub Secrets
Secure your API key as a GitHub secret:
1. Go to your GitHub repository
2. Click **Settings** > **Secrets and variables** > **Actions**
3. Click **New repository secret**
4. Name: `OPENSTATUS_API_KEY`
5. Value: Your openstatus API key
6. Click **Add secret**
### 4. Create the GitHub Action workflow
Create `.github/workflows/openstatus.yml`:
```yaml
name: Run openstatus Synthetics CI
on:
workflow_dispatch: # Manual trigger
push:
branches: [ main ] # Trigger on push to main
pull_request: # Run on PRs (optional)
jobs:
synthetic_ci:
runs-on: ubuntu-latest
name: Run openstatus Synthetics CI
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run openstatus Synthetics CI
uses: openstatushq/openstatus-github-action@v1
with:
api_key: ${{ secrets.OPENSTATUS_API_KEY }}
```
### 5. Commit and push
```bash
git add openstatus.config.yaml .github/workflows/openstatus.yml
git commit -m "Add openstatus synthetic tests to CI"
git push origin main
```
The GitHub Action will run automatically on the next push to `main`.
## What you've accomplished
- Integrated openstatus into your CI/CD pipeline
- Automated synthetic testing on every deployment
- Added a safety check before production releases
- Set up continuous validation of critical endpoints
## Customisation options
### Run on different branches
```yaml
on:
push:
branches: [ main, staging, develop ]
```
### Run on pull requests
```yaml
on:
pull_request:
types: [opened, synchronize, reopened]
```
### Run on a schedule
```yaml
on:
schedule:
- cron: '0 */4 * * *' # Every 4 hours
```
### Multiple configuration files
```yaml
- name: Run openstatus Synthetics CI
uses: openstatushq/openstatus-github-action@v1
with:
api_key: ${{ secrets.OPENSTATUS_API_KEY }}
config_file: .openstatus/production.yaml
```
## Best practices
1. **Start small** — begin with 2–3 critical monitors.
2. **Fail fast** — run synthetic tests early in your pipeline.
3. **Monitor the monitors** — track your synthetic test success rate.
4. **Environment-specific** — use different monitors for staging vs production.
5. **Document failures** — investigate and document any CI failures.
## Troubleshooting
**Action fails with authentication error:**
- Verify `OPENSTATUS_API_KEY` secret is set correctly.
- Check that your API key hasn't been revoked.
**Monitors not found:**
- Confirm monitor IDs are correct in `openstatus.config.yaml`.
- Ensure monitors are active in your openstatus dashboard.
**Tests timing out:**
- Check that your endpoints are accessible from GitHub's runners.
- Consider increasing timeouts in monitor configuration.
## What's next
- **[Monitor your MCP server](/docs/guides/how-to-monitor-mcp-server)** — advanced monitoring examples.
- **[Monitoring as code](/docs/concept/uptime-monitoring-as-code)** — manage monitors with YAML.
- **[CLI reference](/docs/reference/cli-reference)** — automate monitor management.
- **[Export metrics](/docs/guides/how-to-export-metrics-to-otlp-endpoint)** — send data to your observability platform.
- **[GitHub Action on Marketplace](https://github.com/marketplace/actions/openstatus-synthetics-ci)** — official action.
- **[Example repository](https://github.com/openstatusHQ/github-action-example)** — working examples.