GitHub Actions
Covered in this doc
Integrating Percy with GitHub actions
Percy CLI required
These docs are for Percy CLI. If you're currently using an older SDK that uses
@percy/agent
, you will need to use one of our deprecated GitHub Actions
Configuring environment variables
Keep your Percy token secret
Anyone with access to your token can add builds to your project, though they cannot read data.
Start by adding the PERCY_TOKEN
to your repos secrets. PERCY_TOKEN
is your project-specific, write-only API token. It can be found in your Percy project settings and add it to your GitHub project secrets.
In your GitHub project's settings, go to Settings > Secrets and variables > Actions > New repository secret
Then set PERCY_TOKEN
to the write-only token from your Percy project. This token can be found in each Percy project's settings.

Now you can run your tests with Percy (typically percy exec -- [test command]
or percy snapshot [dir|file|sitemap]
) and send builds to Percy from CI.
on:
push:
branches:
- main
jobs:
name: CI
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
- run: npm install --save-dev @percy/cli
- run: npx percy snapshot _site/ # or any directory such as public/
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
Updated 6 months ago