Update Snapshots #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Snapshots | |
on: | |
workflow_dispatch: | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push | |
contents: write | |
packages: read | |
env: | |
NODEJS_VERSION: 20 | |
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} | |
jobs: | |
set_job_params: | |
name: Set Job Params | |
runs-on: ubuntu-latest | |
outputs: | |
pw-version: ${{ steps.set_version.outputs.PW_VERSION }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup NodeJS SDK ${{ env.NODEJS_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
cache: yarn | |
cache-dependency-path: yarn.lock | |
node-version: ${{ env.NODEJS_VERSION }} | |
registry-url: 'https://npm.pkg.github.com' | |
scope: '@angelo-loria' | |
- name: Yarn Install | |
run: yarn install --mode=skip-build | |
env: | |
NODE_AUTH_TOKEN: ${{ env.PACKAGE_TOKEN }} | |
- name: Get Playwright Package Version | |
id: get-version | |
uses: beaconbrigade/[email protected] | |
with: | |
path: node_modules/playwright | |
- name: Set Package Version | |
id: set_version | |
run: echo "PW_VERSION=${{ steps.get-version.outputs.version }}" >> $GITHUB_OUTPUT | |
update_snapshots: | |
name: Update Snapshots | |
needs: set_job_params | |
runs-on: ubuntu-latest | |
container: | |
image: mcr.microsoft.com/playwright:v${{ needs.set_job_params.outputs.pw-version }}-jammy | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup NodeJS SDK ${{ env.NODEJS_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
cache: yarn | |
cache-dependency-path: yarn.lock | |
node-version: ${{ env.NODEJS_VERSION }} | |
registry-url: 'https://npm.pkg.github.com' | |
scope: '@angelo-loria' | |
- name: Yarn Install | |
run: yarn install | |
env: | |
NODE_AUTH_TOKEN: ${{ env.PACKAGE_TOKEN }} | |
- name: Update Snapshots | |
run: yarn test --grep snapshot --update-snapshots --reporter=list | |
env: | |
HOME: /root # required for playwright to run in container | |
- name: Commit and Push Snapshots | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Update Playwright Snapshots | |
file_pattern: "tests/visual/*.png" |