This framework runs on GitHub Actions with Bun. Three workflows cover pull requests, nightly runs, and production checks. Each job uses a GitHub Environment, which scopes the credentials to that environment.
| Workflow | File | Trigger | Environment | Stages |
|---|---|---|---|---|
| CI | .github/workflows/ci.yml |
pull request and push to main |
dev (smoke stage only) |
Format check, Lint, Smoke tests (dev), CI |
| Nightly | .github/workflows/nightly.yml |
02:00 UTC daily, or manual | qa and staging (matrix) |
Smoke and integration |
| Production smoke | .github/workflows/prod-smoke.yml |
06:00 UTC on weekdays, or manual | production |
Production smoke (@prod) |
| Sauce Labs | .github/workflows/sauce.yml |
manual only | dev |
Validate and run on Sauce Labs (see sauce-labs.md) |
| Dependency audit | .github/workflows/audit.yml |
05:00 UTC on Mondays, or manual | none | bun audit against the npm advisory database |
When a scheduled nightly or production smoke run fails, a report-failure job opens one issue titled
Scheduled run failed: <workflow>, labelled scheduled-failure, and links the run. Later failures add a comment to
that open issue rather than opening another. Close the issue once the failure is fixed. Manual runs do not open issues.
The job requests only issues: write, and it runs only for scheduled events. Failure issues are created only after the
scheduled-runs switch is set (see Turning on scheduled runs).
The CI workflow has four jobs. Each one appears as its own box in the Actions graph.
flowchart LR
F["Format check"] --> S["Smoke tests (dev)"]
L["Lint"] --> S
F --> C["CI"]
L --> C
S --> C
Text alternative: Format check and Lint run in parallel. Smoke tests (dev) run only when both pass. The final job, CI, passes only when all three succeeded. Branch protection requires CI.
| Job | Shown as | Waits for | Environment | Purpose |
|---|---|---|---|---|
format |
Format check | nothing | none | bun run format:check |
lint |
Lint | nothing | none | bun run lint |
smoke |
Smoke tests (dev) | format, lint |
dev |
Browser install, bun run test:smoke, summary, report upload |
ci |
CI | format, lint, smoke |
none | Fails unless every stage succeeded, including skipped or cancelled stages |
Format and Lint need no secrets, so they also run for pull requests from forks. Only the smoke stage selects the dev
Environment, because only it needs E2E_USERNAME and E2E_PASSWORD.
A failed gate skips the smoke stage. The CI job then fails, because a skipped stage is not a success.
Both workflows have one test stage, so they keep a single job. Their steps are named the same way: Checkout, Setup
Bun, Setup Playwright, Run tests, Summary, Upload reports. The nightly matrix runs qa and staging as separate jobs.
flowchart TD
SCHED1["Schedule 02:00 UTC"] --> NIGHT["nightly.yml: matrix qa and staging"]
MANUAL1["Manual run"] --> NIGHT
SCHED2["Schedule weekdays 06:00 UTC"] --> PROD["prod-smoke.yml: @prod on production"]
MANUAL2["Manual run"] --> PROD
NIGHT --> ART["Summary and reports/ artifact"]
PROD --> ART
Text alternative: a nightly schedule or a manual run executes the matrix on qa and staging. A weekday schedule or a
manual run executes @prod tests on production. Both write a run summary and upload reports/ as an artifact.
The nightly and production workflows skip their scheduled runs until you turn them on. Without this, the first scheduled
run would fail, because the qa, staging, and production environments and their secrets do not exist yet. Manual
runs (workflow_dispatch) always work, so you can test each environment first.
Turn them on in this order:
- Create each environment and set its
E2E_USERNAMEandE2E_PASSWORDsecrets (see Environments and secrets). - Run each workflow manually and confirm it passes.
- Set the repository variable:
gh variable set ENABLE_SCHEDULED_RUNS --body true --repo <owner>/<repo>
To pause scheduled runs again, set the variable to any value other than true. The skipped scheduled runs show as
skipped, not failed.
Two local composite actions replace the setup steps that used to be copied into each workflow:
| Action | Path | Does |
|---|---|---|
| Setup Bun | .github/actions/setup-bun |
Installs Bun, restores the Bun package cache keyed on bun.lock, runs bun install --frozen-lockfile |
| Setup Playwright | .github/actions/setup-playwright |
Reads the installed Playwright version, restores the browser cache, then installs Chromium on a miss or only its system dependencies on a hit |
Both need the repository checked out first. Setup Playwright must run after Setup Bun, because it reads the version from the installed dependencies.
After each test run, scripts/ci-summary.js writes a short Markdown table to the run's summary page: environment, total
tests, passed, failed, and skipped. It reads reports/junit/results.xml, which Playwright writes when CI is set. If the
file is missing, the summary says so and the step still succeeds, so a summary problem never fails a run.
Each job selects a GitHub Environment with environment:. The environment's secrets are the only credentials the job
can read.
| GitHub Environment | Secrets | Protection |
|---|---|---|
dev |
E2E_USERNAME, E2E_PASSWORD |
none |
qa |
E2E_USERNAME, E2E_PASSWORD |
none |
staging |
E2E_USERNAME, E2E_PASSWORD |
optional |
production |
E2E_USERNAME, E2E_PASSWORD |
required reviewers recommended |
Set them up once. Replace <owner>/<repo> with the repository, for example codewithmmak/playwright-javascript. Run
these as an account with admin rights on the repository.
# Create the environments (idempotent)
gh api --method PUT repos/<owner>/<repo>/environments/dev
gh api --method PUT repos/<owner>/<repo>/environments/qa
gh api --method PUT repos/<owner>/<repo>/environments/staging
gh api --method PUT repos/<owner>/<repo>/environments/production
# Set secrets. gh prompts for the value, so it is not stored in shell history.
gh secret set E2E_USERNAME --env dev --repo <owner>/<repo>
gh secret set E2E_PASSWORD --env dev --repo <owner>/<repo>Repeat the two gh secret set commands for qa, staging, and production with the accounts for each environment.
Required reviewers for production: set them in Settings → Environments → production → Required reviewers. The API
needs reviewer IDs, so the UI is simpler. If reviewers are required, a scheduled prod-smoke run waits for approval
before it starts. Decide whether that is what you want before you enable it.
Remove old secrets. Repository secrets ORANGEHRM_USERNAME and ORANGEHRM_PASSWORD were used before this layout.
Delete them once the dev environment has E2E_* secrets:
gh secret delete ORANGEHRM_USERNAME --repo <owner>/<repo>
gh secret delete ORANGEHRM_PASSWORD --repo <owner>/<repo>Forks: pull requests from forks do not receive environment secrets, so the smoke stage fails for them. Format and Lint still run. This is expected.
Protect main so that merges require the aggregate CI check to pass.
The protection rule must name the check that the workflow reports. Before the stage split, that was "Format, lint, and smoke tests (dev)". That name no longer exists. A rule that still requires it blocks every merge.
Safe order when changing the rule:
- Open the pull request. Its run reports a check named CI on the pull request head.
- Wait until CI is green.
- In Settings → Branches, change the required check for
mainto CI, or run:wheregh api --method PUT repos/<owner>/<repo>/branches/main/protection --input protection.json
protection.jsonhasrequired_status_checks.contextsset to["CI"]. This is an admin action. - Merge the pull request normally. Its own CI check satisfies the new rule.
Optionally require one approving review as well.
Every job follows the same pattern:
- Checkout (
actions/checkout, pinned to a commit SHA) - Setup Bun (local action, installs locked dependencies)
- Setup Playwright (local action, browser cache), for jobs that run tests
- The command, with
TEST_ENVand the environment's secrets - Summary (
scripts/ci-summary.js), always - Upload
reports/as an artifact, always, retained for 14 to 30 days
Permissions are contents: read. Actions are pinned to commit SHAs. Renovate updates the pins, with a comment naming the
version (see renovate.json).
Each run uploads an artifact named for the workflow, the environment, and the run ID. The run summary shows the result
table and names the artifact. Open monocart/index.html from the artifact to view the full report. See
reporting.md.
| Symptom | Likely cause |
|---|---|
Set E2E_USERNAME and E2E_PASSWORD in the Smoke tests log |
The dev Environment is missing secrets |
| The CI check is red but no test ran | A format or lint stage failed. Smoke tests is skipped, and CI reports the stage results |
| Pull requests wait for a check named "Format, lint, and smoke tests (dev)" | Branch protection still requires the old name. Change it to CI (see Branch protection) |
| Job waits at "Waiting for approval" | The production environment has required reviewers and this is a scheduled run |
| The smoke stage fails only on a fork pull request | Forks do not receive secrets (expected) |
bun install --frozen-lockfile fails |
bun.lock is out of date. Run bun install locally and commit the lockfile |
| The run summary says "No JUnit results were written" | The test step failed before Playwright wrote its results, so check that step's log |