name: Percy
on:
  pull_request:
    types:
      - labeled
      - opened
      - reopened
      - synchronize
    paths:
      - "package.json"
      - "origami.json"
      - "main.js"
      - "main.scss"
      - "demos/**"
      - "src/**"
  push:
    branches: master
    paths:
      - "package.json"
      - "origami.json"
      - "main.js"
      - "main.scss"
      - "demos/**"
      - "src/**"

jobs:
  percy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v2.1.5
      with:
        node-version: '14.x'
        registry-url: 'https://registry.npmjs.org'
    - run: npm install -g "npm@^7"
    - run: npm ci
    - uses: Financial-Times/origami-percy@v2
      with:
        github-token: ${{secrets.ORIGAMI_FOX_ACCESS_TOKEN}} # To comment as the Fox mascot GitHub user
      env:
        PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
