
How to post screenshot previews to every GitHub PR automatically
How to Post Screenshot Previews to Every GitHub PR Automatically Tools like Percy and Chromatic give you visual PR previews, but they're priced per screenshot and require an SDK integration. For many teams, the pricing doesn't justify the setup. Here's the lightweight alternative: when a PR is opened or updated, screenshot the preview deployment, and post the images directly to the PR as a comment. No SDK, no per-seat pricing — just a GitHub Actions job and two API calls. Prerequisites A preview deployment that spins up per PR (Vercel, Netlify, Railway, Render, or self-hosted) The preview URL available as an environment variable or output from your deploy step GitHub Actions workflow # .github/workflows/pr-preview.yml name : PR screenshot preview on : pull_request : types : [ opened , synchronize , reopened ] jobs : screenshot-preview : runs-on : ubuntu-latest # Only run if a preview URL is available if : github.event.pull_request.head.repo.full_name == github.repository steps : - uses
Continue reading on Dev.to Webdev
Opens in a new tab




