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

Then set PERCY_TOKEN to the write-only token from your Percy project. This token can be found in each Percy project's settings.

803803

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.

name: CI
  build:
    runs-on: ubuntu-latest
      - uses: actions/[email protected]
      
      # Build
      
      - name: Percy Test
        run: npx @percy/cli snapshot _site/ # or any directory such as public/

What's next