SnapPDFSnapPDF
integration · dev · live

SnapPDF + GitHub Actions

Merge generated docs into a release PDF on tag push.

The SnapPDF GitHub Action (published at github.com/snappdf/action) wraps the CLI for CI/CD pipelines. Most common use: on release tag, generate API docs from source, merge with changelog + cover, and upload the resulting PDF as a release asset. Also used for automated compliance-doc generation, marketing-collateral refresh, and nightly OCR of a crawl corpus.

What you can build

  • Single `snappdf/action@v1` step does any op via a `command:` input.
  • Artifact upload to GitHub releases or Actions artifacts.
  • Secrets-friendly: reads `SNAPPDF_API_KEY` from repo secrets.
  • Cacheable: pins to a specific action version for reproducibility.
  • Self-hosted runners supported — all requests go outbound to api.snappdf.dev.

Setup

  1. 01
    Add your SnapPDF key as a repo secret
    GitHub → Settings → Secrets and variables → Actions → New. Name: `SNAPPDF_API_KEY`. Value: your `sk_live_…`.
  2. 02
    Reference the action in a workflow
    Use `snappdf/action@v1` in your workflow YAML. Pin a SHA for supply-chain safety.
  3. 03
    Configure a command
    Pass a `command` block with the op and args. Inputs and outputs are files in the runner filesystem.
  4. 04
    Output the result
    Use `actions/upload-artifact` or `softprops/action-gh-release` to ship the PDF downstream.

Code example

Workflow that generates a release PDF on every tag push.

name: Release PDF

on:
  push:
    tags:
      - 'v*'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Generate API docs
        run: npm run docs:pdf  # outputs docs.pdf

      - name: Merge with changelog
        uses: snappdf/action@v1
        with:
          command: merge
          files: |
            cover.pdf
            docs.pdf
            CHANGELOG.pdf
          output: release-${{ github.ref_name }}.pdf
        env:
          SNAPPDF_API_KEY: ${{ secrets.SNAPPDF_API_KEY }}

      - name: Stamp version
        uses: snappdf/action@v1
        with:
          command: watermark
          input: release-${{ github.ref_name }}.pdf
          output: final.pdf
          args: --text "${{ github.ref_name }}" --position bottom-right --opacity 0.4
        env:
          SNAPPDF_API_KEY: ${{ secrets.SNAPPDF_API_KEY }}

      - uses: softprops/action-gh-release@v2
        with:
          files: final.pdf

Known limits

  • · GitHub Actions has a 6-hour job timeout; our CLI streams progress so long OCR remains visible.
  • · Free-tier GitHub accounts have 2000 minutes/mo — OCR a lot of pages and you'll consume them on the CI side too.

Pricing notes

Free action. CI ops count against your plan quota — use test keys in branches.

Available from the Free plan.

FAQ

Does this eat my SnapPDF quota on every CI run?

Yes. Pin workflow triggers narrowly (tag push, not every commit) and use `sk_test_…` for branch builds.

Can I run this on self-hosted runners?

Yes. The action needs only outbound HTTPS to api.snappdf.dev.

Does it support matrix builds?

Yes — the action is stateless.

How do I cache across jobs?

Use `actions/cache` on the output directory; SnapPDF itself has no cacheable state.

Is there a similar action for GitLab / CircleCI?

Not officially yet — use the CLI (`npx @snappdf/cli`) in any CI. GitLab + CircleCI packages are on the roadmap.

Start freeRead the quickstart

Related integrations