name: Visual Regression Testing
on: [pull_request]
jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            - name: Checkout repository
              uses: actions/checkout@v2
            - name: Set up Node
              uses: actions/setup-node@v1
              with:
                  node-version: 16
            - name: Upgrade npm
              run: npm i -g npm@latest
            - name: Get baseline screenshots
              run: |
                  git fetch
                  git checkout origin/$GITHUB_BASE_REF
                  npm ci
                  npm run build
                  node dist/test/capture-screenshots.js
                  npm run test:visual:accept

            - name: Get current screenshots
              run: |
                  git checkout $GITHUB_SHA
                  npm ci
                  npm run build
                  node dist/test/capture-screenshots.js
            - name: Test
              run: npx reg-suit run -c .config/regconfig.json --test
            - name: Upload Results
              uses: actions/upload-artifact@v3
              with:
                  name: visual-regression
                  path: dist/tmp/.reg

name: Visual Regression Testing
on: [workflow_dispatch]
jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            - name: Checkout repository
              uses: actions/checkout@v2
            - name: Set up Node
              uses: actions/setup-node@v1
              with:
                  node-version: 16
            - name: Upgrade npm
              run: npm i -g npm@latest
            - name: Get baseline screenshots
              run: |
                  git fetch
                  git checkout origin/$GITHUB_BASE_REF
                  npm ci
                  npm run build
                  node dist/test/capture-screenshots.js
                  npm run test:visual:accept

            - name: Get current screenshots
              run: |
                  git checkout $GITHUB_SHA
                  npm ci
                  npm run build
                  node dist/test/capture-screenshots.js
            - name: Test
              run: npx reg-suit run -c .config/regconfig.json --test
            - name: Upload Results
              uses: actions/upload-artifact@v3
              with:
                  name: visual-regression
                  path: dist/tmp/.reg

Make visual regression a manual job
Make visual regression a manual job
