Scrnify blog

GitHub Actions Recipes for Screenshots and Videos

Updated 7/14/2026

This is a shell workflow, not an official Scrnify GitHub Action. Scrnify does not publish one. These recipes install the scrnify CLI, run normal shell commands, then use GitHub's official artifact upload Action for the resulting file.

The examples use macos-latest because the CLI has a Homebrew Formula. Release archives are also available for macOS and Linux on amd64 and arm64 from GitHub Releases.

Add SCRNIFY_API_KEY as a GitHub Actions repository secret before running any recipe. Do not put the key directly in workflow YAML.

Base GitHub Actions shell workflow

The CLI prints only the captured asset URL on success. Save that URL, then download the file you want to upload. Authentication uses SCRNIFY_API_KEY; the CLI sends it to the Capture API without writing it to normal output.

name: capture-page

on:
    workflow_dispatch:

jobs:
    capture:
        runs-on: macos-latest
        steps:
            - uses: actions/checkout@v5
            - name: Install scrnify CLI
              run: brew install scrnify/tap/scrnify
            - name: Capture page
              env:
                  SCRNIFY_API_KEY: ${{ secrets.SCRNIFY_API_KEY }}
                  TARGET_URL: https://example.com
              run: |
                  capture_url="$(scrnify capture "$TARGET_URL" --type image --format png --full-page)"
                  curl -fsSL "$capture_url" -o capture.png
            - name: Upload capture
              uses: actions/upload-artifact@v4
              with:
                  name: page-capture
                  path: capture.png

GitHub's default Bash shell runs these steps with fail-fast behavior, so a failed scrnify command or curl -f stops the step. Exit code 1 from the CLI means invalid usage or config; exit code 2 means an API, HTTP, or network failure. Success prints one asset URL and exits 0; it does not inspect the image or decide whether CI should pass on visual quality.

Deploy-preview screenshot artifact

Run this job after your host exposes a preview URL. Pass the URL through a job output, repository variable, or workflow_dispatch input rather than hard-coding a temporary deploy URL.

name: preview-screenshot

on:
    workflow_dispatch:
        inputs:
            preview_url:
                description: Public deploy preview URL
                required: true
                type: string

jobs:
    preview:
        runs-on: macos-latest
        steps:
            - name: Install scrnify CLI
              run: brew install scrnify/tap/scrnify
            - name: Capture deploy preview
              env:
                  SCRNIFY_API_KEY: ${{ secrets.SCRNIFY_API_KEY }}
                  PREVIEW_URL: ${{ inputs.preview_url }}
              run: |
                  capture_url="$(scrnify capture "$PREVIEW_URL" --type image --format png --full-page)"
                  curl -fsSL "$capture_url" -o deploy-preview.png
            - uses: actions/upload-artifact@v4
              with:
                  name: deploy-preview
                  path: deploy-preview.png

Scrnify can only reach URLs available to its remote Capture service. Use Playwright on the runner when the preview needs a private network, login session, clicks, or seeded browser state.

Refresh a docs screenshot

This recipe writes the downloaded PNG into the checked-out docs tree, then uploads the changed file for review. It does not push to the repository.

name: refresh-docs-screenshot

on:
    workflow_dispatch:

jobs:
    refresh:
        runs-on: macos-latest
        steps:
            - uses: actions/checkout@v5
            - run: brew install scrnify/tap/scrnify
            - name: Capture docs page
              env:
                  SCRNIFY_API_KEY: ${{ secrets.SCRNIFY_API_KEY }}
                  DOCS_URL: https://example.com/docs
              run: |
                  mkdir -p docs/assets
                  capture_url="$(scrnify capture "$DOCS_URL" --type image --format png --full-page)"
                  curl -fsSL "$capture_url" -o docs/assets/product.png
            - uses: actions/upload-artifact@v4
              with:
                  name: refreshed-docs-screenshot
                  path: docs/assets/product.png

Review the artifact before committing it. A successful Capture proves a file was created; it does not assert that the page looks correct.

Capture a short bug-report video

Use video for loading behavior, animation, or a visual issue that a still image misses.

name: bug-report-video

on:
    workflow_dispatch:
        inputs:
            target_url:
                description: Public URL that reproduces the issue
                required: true
                type: string

jobs:
    record:
        runs-on: macos-latest
        steps:
            - run: brew install scrnify/tap/scrnify
            - name: Record five seconds
              env:
                  SCRNIFY_API_KEY: ${{ secrets.SCRNIFY_API_KEY }}
                  TARGET_URL: ${{ inputs.target_url }}
              run: |
                  capture_url="$(scrnify capture "$TARGET_URL" --type video --format mp4 --duration 5)"
                  curl -fsSL "$capture_url" -o bug-report.mp4
            - uses: actions/upload-artifact@v4
              with:
                  name: bug-report-video
                  path: bug-report.mp4

Video Capture records the URL-reachable page state after its lifecycle wait. It does not perform a scripted reproduction. Use Playwright or Puppeteer when the bug requires login, clicks, typing, assertions, or a private environment.

Signed requests in CI

If your API key uses a signing secret, store that secret as SCRNIFY_API_SECRET and set a non-zero cache TTL. The CLI computes the HMAC-SHA256 signature; the secret is not printed in normal output.

- name: Signed Capture
  env:
      SCRNIFY_API_KEY: ${{ secrets.SCRNIFY_API_KEY }}
      SCRNIFY_API_SECRET: ${{ secrets.SCRNIFY_API_SECRET }}
  run: |
      scrnify capture https://example.com --cache-ttl 86400

Choose the focused workflow for deploy-preview screenshots, general CI screenshots, docs screenshot refreshes, or a bug-report video. For output behavior and limits, see the CLI page, Capture API docs, and current pricing.

Open beta

Start with one Capture

Join the open beta and create screenshots or videos without local browser setup.

Join Open Beta