Skip to content
NEWMeet Alaaddin, your AI genie with a voice. trig8n launches 1 January 2027. See what is new

Library / Code, Git & Developer Tools

Code, Git & Developer Tools

Post PR preview page screenshots to GitHub pull requests with Snapshot Site

When an API call/webhook arrives, it automates developer work using GitHub, Snapshot Site.

What it does

## Screenshot PR Preview Pages → GitHub PR Comment ### How it works Your CI job calls this workflow's webhook once a pull-request preview deployment is live, POSTing owner, repository, prNumber, the preview base URL and — the important part — a pages array holding only the routes the pull request actually touched (built from git diff --name-only). A Code node joins each path onto previewUrl (handling a trailing slash on the base and a leading slash on the path without producing //), rejects any URL that is missing its https:// scheme, drops duplicate routes and caps the run at maxPages (10 by default). A single 30-second Wait lets the preview deployment warm up, then the loop takes one page per iteration through a Snapshot Site Screenshot call — WebP, 1280px wide, full page, cookie banners hidden — and records one row per page (label, URL, returned image link, ok / failed). Hard failures (network/HTTP after 3 retries) and soft failures (HTTP 200 + {error: true}) both land on the same recorder marked failed, and the loop keeps going. When the loop finishes, one Code node renders every row into a single GitHub-flavoured markdown body — a summary table, one collapsible embedded screenshot per captured page, and a clearly separated "could not be captured" block — and the GitHub node posts it as one comment on the pull request. ### Setup steps - Install the n8n-nodes-snapshot-site community node (Settings → Community nodes → Install → n8n-nodes-snapshot-site) — verified by n8n. - Add a Snapshot Site credential and a GitHub credential (classic PAT with repo, or a fine-grained token with Pull requests: Read and write on the target repo). - owner, repository and issueNumber on the GitHub node are all driven by the webhook payload, so one workflow serves every repo that calls it — nothing to hardcode. - Activate the workflow and copy the Webhook node's Production URL (the Test URL only listens while the editor is open). - Call it from your preview-deploy job with {"owner":"your-org","repository":"your-repo","prNumber":123,"previewUrl":"https://pr-123.preview.example.com","commit":"a1b2c3d","maxPages":10,"pages":[{"path":"/","label":"Home"},{"path":"/pricing","label":"Pricing"}]}. - Build pages from the PR's diff, not from a static list — the README has a copy-pasteable GitHub Actions step that maps git diff --name-only to routes. Skip the call entirely when the diff

The steps

  1. When a Pull Request Preview Is Ready
  2. Build Preview Page List
  3. Wait for Preview to Settle
  4. Loop Over Changed Pages
  5. Capture Preview Page
  6. Check for API Error
  7. Record Page Capture
  8. Record Failed Capture
  9. Build PR Comment
  10. Post Preview Screenshots on the PR

Similar automations