Skip to content

CI/CD Integration

Autowright fits the common automation setup: scripts fire from CI jobs or cron, while the service and fixer run somewhere long-lived. The script side is stateless — each run just needs to reach the service and artifact storage.

What the runner needs

The CI job runs your script, so it needs the script-side configuration:

RequirementWhy
serviceUrl reachable from the runnerFailure metadata is POSTed to the service
Storage endpoint reachable from the runnerThe browser package uploads evidence bundles directly to S3-compatible storage
Storage credentials in envPassed into the storage block of the config

The fixer’s secrets (ANTHROPIC_API_KEY, GITHUB_TOKEN) live with the fixer, not in CI — your runner never talks to Anthropic or opens PRs.

Honest exit codes

Autowright re-throws every error, so a failed script fails its CI job exactly as it did before. Your job status, alerting, and retry logic stay truthful — there is no “Autowright caught it, so CI went green” mode.

The fix arrives asynchronously: the job that failed stays red, and a PR (or a needs-attention notification) shows up minutes later.

Retries don’t spam PRs

Scheduled jobs retry; broken sites stay broken. Every report is deduplicated by error hash, so an hourly cron hitting the same broken selector produces one fix job — not one per run. Repeat reports within the dedupe window (default 24 hours) are counted, not re-queued.

Example: GitHub Actions on a schedule

.github/workflows/scrape.yml
name: Nightly scrape
on:
schedule:
- cron: '0 2 * * *'
jobs:
scrape:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npx playwright install chromium
- run: npx tsx src/scraper.ts
env:
AUTOWRIGHT_SERVICE_URL: ${{ vars.AUTOWRIGHT_SERVICE_URL }}
STORAGE_ENDPOINT: ${{ vars.STORAGE_ENDPOINT }}
STORAGE_BUCKET: autowright-artifacts
MINIO_ACCESS_KEY: ${{ secrets.STORAGE_ACCESS_KEY }}
MINIO_SECRET_KEY: ${{ secrets.STORAGE_SECRET_KEY }}

Read the env vars inside your script’s config:

autowright: {
scriptId: 'nightly-scrape',
serviceUrl: process.env.AUTOWRIGHT_SERVICE_URL,
repoUrl: 'https://github.com/your-org/scrapers',
scriptPath: 'src/scraper.ts',
storage: {
provider: 's3',
endpoint: process.env.STORAGE_ENDPOINT,
bucket: process.env.STORAGE_BUCKET,
accessKey: process.env.MINIO_ACCESS_KEY,
secretKey: process.env.MINIO_SECRET_KEY,
forcePathStyle: true,
},
}

Closing the loop

The PRs the fixer opens flow through your normal review process — CI runs on the fix branch like any other PR. The next scheduled run after merge is the real verification that the script healed.