Loading...
Loading...
Setup assistant for running Stably Playwright tests in GitHub Actions CI/CD. Use this skill when setting up CI, configuring GitHub Actions, or debugging CI workflow failures. Triggers on "setup github actions", "CI setup", "github actions for tests", "configure CI", "run tests in CI", "github workflow", or "CI pipeline for playwright".
npx skill4agent add stablyai/agent-skills github-actions-setupSetting up GitHub Actions for Stably Playwright tests!
Step 1 of 5: Detecting your project setup...pnpm-lock.yamlyarn.lockpackage-lock.json.yarnrc.ymlpackageManagerpackage.json"yarn@4.1.0"--immutable--frozen-lockfilecorepack enable.nvmrc.node-versionengines.nodepackage.json'20'playwright.config.tsplaywright.config.jsplaywright.config.mjstestDirtests/e2e/test/playwright.config.*workspacespackage.jsonpnpm-workspace.yamllerna.jsonworking-directorystablydevDependenciespackage.json@stablyai/playwright-teststablystably: command not foundnpm install -D stably.github/workflows/Detected setup:
- Package manager: [pnpm/yarn/npm]
- Stably CLI (`stably`): [installed / MISSING — needs install]
- Node.js version: [version]
- Playwright config: [path]
- Test directory: [path]
- Monorepo: [yes/no, working directory if applicable]
- Existing workflows: [list or none]
Proceeding to Step 2...Step 2 of 5: Choose workflow features
Which features would you like in your CI workflow?
1. **Basic** - Run tests on push/PR (recommended to start)
2. **Self-healing** - Run tests + auto-fix failures + create PR with fixes
3. **Scheduled** - Run tests on a cron schedule (e.g., nightly)
4. **Custom** - Let me know what you need
Default: Basic (option 1)Step 3 of 5: Generating workflow file...corepack enablepnpmpnpm: command not foundcorepack enableactions/setup-nodenpm cistably install --with-deps chromiumstably installplaywright install--with-deps--with-depschromiumrun:env:run:working-directory:npx stablynpx stablystablynpxnode_modulesstablystably@stablyai/playwright-teststablydevDependenciesnpx stablypackage.json"stably"devDependenciesnpm install -D stablyname: Stably E2E Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
e2e-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
STABLY_API_KEY: ${{ secrets.STABLY_API_KEY }}
STABLY_PROJECT_ID: ${{ secrets.STABLY_PROJECT_ID }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install browsers
run: npx stably install --with-deps chromium
- name: Run tests
run: npx stably test
- name: Upload test artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 30name: Stably E2E Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
e2e-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
STABLY_API_KEY: ${{ secrets.STABLY_API_KEY }}
STABLY_PROJECT_ID: ${{ secrets.STABLY_PROJECT_ID }}
steps:
- uses: actions/checkout@v4
- name: Enable corepack
run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install browsers
run: pnpm exec stably install --with-deps chromium
- name: Run tests
run: pnpm exec stably test
- name: Upload test artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 30name: Stably E2E Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
e2e-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
STABLY_API_KEY: ${{ secrets.STABLY_API_KEY }}
STABLY_PROJECT_ID: ${{ secrets.STABLY_PROJECT_ID }}
steps:
- uses: actions/checkout@v4
- name: Enable corepack
run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Install browsers
run: yarn stably install --with-deps chromium
- name: Run tests
run: yarn stably test
- name: Upload test artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 30Note: Yarn berry (v2+) resolves local bin entries via, soyarn <bin>works directly. This does NOT work in yarn classic — see the classic template below.yarn stably
name: Stably E2E Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
e2e-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
STABLY_API_KEY: ${{ secrets.STABLY_API_KEY }}
STABLY_PROJECT_ID: ${{ secrets.STABLY_PROJECT_ID }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Install browsers
run: npx stably install --with-deps chromium
- name: Run tests
run: npx stably test
- name: Upload test artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 30Note: Yarn classic (v1) is pre-installed on GitHub runners — noneeded. Usecorepack enableinstead ofnpx stablysince yarn classic doesn't resolve bin entries the same way.yarn stably
defaults.run.working-directoryjobs:
e2e-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/app # adjust to detected path
# ... rest of jobcache-dependency-pathsetup-node# pnpm
cache-dependency-path: 'packages/app/pnpm-lock.yaml'
# npm
cache-dependency-path: 'packages/app/package-lock.json'
# yarn
cache-dependency-path: 'packages/app/yarn.lock'Note:only applies todefaults.run.working-directorysteps, notrun:steps likeuses:oractions/checkout. This is correct — you want to checkout at the repo root.actions/setup-node
permissionsjobs:
e2e-tests:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
# ... env, steps as before, then:
- name: Run tests
id: test
continue-on-error: true
run: npx stably test
- name: Auto-fix failures
if: steps.test.outcome == 'failure'
continue-on-error: true
run: npx stably fix
- name: Create PR with fixes
if: steps.test.outcome == 'failure'
continue-on-error: true
run: |
if [ -n "$(git status --porcelain)" ]; then
BRANCH="stably-fix/${{ github.run_id }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH"
git add -A
git commit -m "fix: auto-repair failing tests"
git push origin "$BRANCH"
gh pr create \
--title "fix: auto-repair failing tests" \
--body "Automated PR from Stably Fix after test failures in run #${{ github.run_number }}." \
--base "${{ github.event.pull_request.base.ref || github.ref_name }}" \
--head "$BRANCH"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload test artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Fail if tests failed
if: steps.test.outcome == 'failure'
run: |
echo "::error::Tests failed. A fix PR may have been created."
exit 1permissionscontents: writepull-requests: writeid: testcontinue-on-error: true--basegithub.event.pull_request.base.refgithub.ref_namegithub.ref_nameGITHUB_TOKENstably fixghgh pr createubuntu-latestghon:
push:
branches: [main, master]
pull_request:
branches: [main, master]
schedule:
- cron: '0 6 * * *' # Daily at 6 AM UTC
workflow_dispatch: # Allow manual triggers from the Actions tabpushpull_requestStep 4 of 5: Write workflow file
I'll create the following file:
.github/workflows/stably-e2e.yml
[show full YAML]
May I write this file?Now you need to add your Stably credentials as GitHub repository secrets:
1. Go to your repo on GitHub -> Settings -> Secrets and variables -> Actions
2. Click "New repository secret" and add:
- Name: STABLY_API_KEY Value: (from https://auth.stably.ai/org/api_keys/)
- Name: STABLY_PROJECT_ID Value: (from your Stably dashboard)
Without these secrets, the workflow will fail with authentication errors.The GITHUB_TOKEN secret is automatically provided by GitHub Actions -
no additional setup needed for the auto-fix PR step.Step 5 of 5: Verification
Checking the generated workflow...GitHub Actions setup complete!
Created: .github/workflows/stably-e2e.yml
Your workflow will:
- Trigger on [push/PR to main | schedule | etc.]
- Install [npm/pnpm/yarn] dependencies with caching
- Install Playwright browsers
- Run Stably tests
[- Auto-fix failures and create PRs (if self-healing)]
[- Run on schedule: daily at 6 AM UTC (if scheduled)]
Next steps:
1. Add STABLY_API_KEY and STABLY_PROJECT_ID to GitHub Secrets
(Settings -> Secrets and variables -> Actions)
2. Push this workflow to your repository
3. Watch the run in the Actions tab
Troubleshooting:
- "stably: command not found" -> ensure `stably` is in package.json devDependencies (this is the CLI package; `@stablyai/playwright-test` is the SDK)
- "browser not found" -> the 'Install browsers' step should handle this
- Auth errors -> verify your GitHub Secrets are set correctly
- pnpm not found -> ensure corepack enable runs before setup-node
Happy testing!npx stablypnpm exec stablyyarn stablynpx stablystablySTABLY_API_KEYSTABLY_PROJECT_IDcorepack enableactions/setup-node--frozen-lockfile--immutablenpm ciworking-directory${{ secrets.* }}