sireg
Browse documentation

Astro

Install from the npm lockfile and check Astro’s static output inside Actions.

Save the workflow as .github/workflows/website-regression.yml and set PRODUCTION_SITEMAP to your live sitemap. Commit package-lock.json and provide an npm build script that runs astro build. The workflow serves Astro’s default static output, dist/. Set BUILD_DIR if your project uses a different output directory.

If your Astro config sets a base such as /docs/, set SITE_PREFIX to /docs without the trailing slash. Keep / at the domain root. If your routes use directory URLs, use their canonical trailing slashes in the sitemap.

For server-rendered Astro projects, use a hosted preview on Netlify or Vercel so requests reach the deployed runtime.

Download astro.yml

YAML
name: Astro regression

on: [pull_request]

permissions:
  contents: read

env:
  PRODUCTION_SITEMAP: https://example.com/sitemap.xml
  SITE_PREFIX: /

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - name: Build the website
        run: |
          npm ci
          npm run build
      - name: Serve the build and check routes
        env:
          BUILD_DIR: dist
          PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
        run: |
          SITE_ORIGIN=http://127.0.0.1:8000
          serve_dir="$BUILD_DIR"
          if [[ "$SITE_PREFIX" != "/" ]]; then
            serve_dir="$(mktemp -d "$RUNNER_TEMP/sireg-site.XXXXXX")"
            mkdir -p "$(dirname "$serve_dir$SITE_PREFIX")"
            ln -s "$PWD/$BUILD_DIR" "$serve_dir$SITE_PREFIX"
          fi

          python3 -m http.server 8000 --bind 127.0.0.1 --directory "$serve_dir" > "$RUNNER_TEMP/site.log" 2>&1 &
          server=$!
          trap 'kill "$server" 2>/dev/null || true' EXIT
          curl --fail --silent --show-error --retry 10 --retry-delay 1 --retry-connrefused \
            "$SITE_ORIGIN${SITE_PREFIX%/}/" > /dev/null

          npx --yes sireg@1.1.0 check \
            --sitemap "$PRODUCTION_SITEMAP" \
            --origin "$SITE_ORIGIN" \
            --strategy random --limit 25 --seed "$PR_HEAD_SHA" \
            --expect-status 200 --max-redirects 0 \
            --report console --html reports/sireg.html
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: sireg-report
          path: reports/sireg.html
          if-no-files-found: ignore

See coverage and committed suites for full runs, artifact settings, and required checks.