How to Run Synthetic Tests in GitHub Actions
Integrate statusas synthetic monitoring into your CI/CD pipeline
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
statusas 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 statusas account
- A GitHub repository
- At least one monitor configured in statusas
- Admin access to your GitHub repository (for secrets)
Step-by-step guide
1. Create a configuration file
Create a file named statusas.config.yaml in your repository root:
tests:
ids:
- 1
- 2Finding monitor IDs:
- Go to your statusas dashboard.
- Click on a monitor.
- The ID is in the URL:
https://app.statusas.lt/monitors/[ID].
Tip: start with your most critical monitors and expand from there.
2. Get your statusas API key
- Go to Settings → General in your statusas dashboard
- Find the API Keys card
- Click Create and copy the key — you won't see it again after closing the dialog
- 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:
- Go to your GitHub repository
- Click Settings > Secrets and variables > Actions
- Click New repository secret
- Name:
STATUSAS_API_KEY - Value: Your statusas API key
- Click Add secret
4. Create the GitHub Action workflow
Create .github/workflows/statusas.yml:
name: Run statusas 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 statusas Synthetics CI
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run statusas Synthetics CI
uses: openstatushq/statusas-github-action@v1
with:
api_key: ${{ secrets.STATUSAS_API_KEY }}5. Commit and push
git add statusas.config.yaml .github/workflows/statusas.yml
git commit -m "Add statusas synthetic tests to CI"
git push origin mainThe GitHub Action will run automatically on the next push to main.
What you've accomplished
- Integrated statusas 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
on:
push:
branches: [ main, staging, develop ]Run on pull requests
on:
pull_request:
types: [opened, synchronize, reopened]Run on a schedule
on:
schedule:
- cron: '0 */4 * * *' # Every 4 hoursMultiple configuration files
- name: Run statusas Synthetics CI
uses: openstatushq/statusas-github-action@v1
with:
api_key: ${{ secrets.STATUSAS_API_KEY }}
config_file: .statusas/production.yamlBest practices
- Start small — begin with 2–3 critical monitors.
- Fail fast — run synthetic tests early in your pipeline.
- Monitor the monitors — track your synthetic test success rate.
- Environment-specific — use different monitors for staging vs production.
- Document failures — investigate and document any CI failures.
Troubleshooting
Action fails with authentication error:
- Verify
STATUSAS_API_KEYsecret is set correctly. - Check that your API key hasn't been revoked.
Monitors not found:
- Confirm monitor IDs are correct in
statusas.config.yaml. - Ensure monitors are active in your statusas 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 — advanced monitoring examples.
- Monitoring as code — manage monitors with YAML.
- CLI reference — automate monitor management.
- Export metrics — send data to your observability platform.
- GitHub Action on Marketplace — official action.
- Example repository — working examples.