Overview
The Stably GitHub Action allows you to:- Run specific Playwright projects or all projects
- Filter tests using grep patterns
- Control parallelism and retries
- Receive test results as PR comments
- Block deployments on test failures
Setup Instructions
1
Deploy Your Tests
First, ensure your tests are deployed to Stably Cloud:
2
Create API Key Secret
Get your API key from the settings page on the Web UI.Then, go to your GitHub repository, click on “Settings” > “Secrets and variables” > “Actions”. Create a new Repository Secret named
STABLY_API_KEY and paste your API key into the secret value.3
Get Project ID
Find your project ID in your Stably dashboard settings or project URL.
4
Create Workflow File
Create the file
.github/workflows/stably.yaml in your GitHub repository with your test configuration.Basic Configuration
Run All Tests
.github/workflows/stably.yaml
Run Specific Projects
Use theprojects parameter to run specific Playwright projects:
.github/workflows/stably.yaml
Run Tests with Grep Pattern
Combine projects with grep patterns for fine-grained control:.github/workflows/stably.yaml
Pull Request Comments
Enable PR comments to get test results posted directly on your pull requests:.github/workflows/stably.yaml
Advanced Configuration Options
The GitHub Action supports various options to customize test execution:Core Options
api-key(required): Your Stably API keyproject-id(required): Your Stably project IDprojects: Comma-separated list of Playwright projects to run (e.g., “smoke,critical”)grep: Pattern to filter tests (e.g., “@p0” to run only P0 tests)
Execution Options
workers: Number of parallel workers (default: auto, max: 100)retries: Number of retries for failed tests (default: 0)timeout: Test timeout in milliseconds (default: 30000)
Reporting Options
github-comment: Post test results as PR comments (default: false)note: Add contextual information to test runs (e.g., “PR #123”)
Environment Options
environment: Environment name for variable overrides (e.g., “STAGING”, “PRODUCTION”)env-vars: JSON object with environment variable overrides
Complete Example
Here’s a comprehensive example showing multiple test jobs:.github/workflows/stably.yaml
Test Organization
For optimal GitHub Actions integration, organize your tests using Playwright projects:playwright.config.ts
Troubleshooting
Tests Not Running Latest Code
Tests Not Running Latest Code
Ensure you’ve deployed your tests to Stably Cloud:
Project Not Found
Project Not Found
Verify the project names in your workflow match exactly what’s defined in
playwright.config.ts.Permission Denied for PR Comments
Permission Denied for PR Comments
Make sure you’ve set the required permissions in your workflow: