Visual regression testing shouldn't require a complex setup. I built a GitHub Action that captures website screenshots with a single step in your workflow.
The Problem
Every team I've worked with eventually needs visual regression testing. The usual approach:
- Install Puppeteer/Playwright in CI
- Write browser scripts to navigate and screenshot
- Deal with flaky headless Chrome in CI environments
- Manage screenshot storage and comparison
It works, but it's a lot of infrastructure for "take a picture of my website."
The Simple Alternative
I created grabshot-action - a GitHub Action that captures screenshots via API. No browser installation, no flakiness, consistent results.
- name: Screenshot my site
uses: aitaskorchestra/grabshot-action@v1
with:
url: 'https://mysite.com'
api-key: ${{ secrets.GRABSHOT_API_KEY }}
output: 'screenshots/homepage.png'
That's it. The screenshot is saved as a file you can upload as an artifact, commit, or compare.
Use Case: PR Visual Diff
Here's a real workflow - screenshot your production site and PR preview on every pull request:
name: Visual Regression
on: pull_request
jobs:
screenshots:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Screenshot production
uses: aitaskorchestra/grabshot-action@v1
with:
url: 'https://mysite.com'
api-key: ${{ secrets.GRABSHOT_API_KEY }}
output: 'screenshots/production.png'
- name: Screenshot PR preview
uses: aitaskorchestra/grabshot-action@v1
with:
url: 'https://pr-${{ github.event.number }}.preview.mysite.com'
api-key: ${{ secrets.GRABSHOT_API_KEY }}
output: 'screenshots/preview.png'
- uses: actions/upload-artifact@v4
with:
name: visual-regression
path: screenshots/
Use Case: Scheduled Monitoring
Take periodic screenshots to track how your site looks over time:
name: Site Monitor
on:
schedule:
- cron: '0 */6 * * *'
jobs:
monitor:
runs-on: ubuntu-latest
steps:
- name: Screenshot
uses: aitaskorchestra/grabshot-action@v1
with:
url: 'https://mysite.com'
api-key: ${{ secrets.GRABSHOT_API_KEY }}
full-page: 'true'
output: 'monitor/${{ github.run_number }}.png'
Options
| Input | Description | Default |
|---|---|---|
| url | URL to capture | required |
| api-key | Your GrabShot key | required |
| width | Viewport width | 1280 |
| height | Viewport height | 800 |
| full-page | Full page capture | false |
| delay | Wait before capture (ms) | 0 |
| output | File path | screenshot.png |
Getting Started
- Get a free API key at grabshot.dev (100 screenshots/month, no credit card)
- Add it as a repository secret: Settings > Secrets > GRABSHOT_API_KEY
- Add the action to your workflow
The action is open source on GitHub.
Would love feedback on what features would make this more useful for your workflow. Thinking about adding automatic before/after image comparison and PR commenting next.
Top comments (0)