Files
SnapOtter/.github/workflows/update-visual-baselines.yml
T
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
8c2ddf8b3d chore(deps): bump actions/checkout in the actions group (#295)
Bumps the actions group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 6.0.3 to 7.0.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/df4cb1c069e1874edd31b4311f1884172cec0e10...9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 21:42:25 +08:00

53 lines
2.2 KiB
YAML

name: Update Visual Baselines
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update-baselines:
name: Regenerate linux visual baselines
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: ./.github/actions/setup
- name: Get Playwright version
id: pw-version
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
- name: Cache Playwright browsers
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}
- name: Install Playwright browsers (chromium + webkit for device projects)
run: pnpm playwright install --with-deps chromium webkit
- name: Regenerate baselines (desktop + device projects)
run: pnpm playwright test --project=chromium-visual --project=mobile-chromium --project=mobile-webkit --project=tablet-webkit --project=tablet-chromium --update-snapshots
env:
PW_WORKERS: "2"
- name: Open PR with refreshed baselines
env:
GH_TOKEN: ${{ github.token }}
run: |
if git diff --quiet -- 'tests/e2e/__screenshots__'; then
untracked=$(git ls-files --others --exclude-standard -- 'tests/e2e/__screenshots__')
if [ -z "$untracked" ]; then
echo "No baseline changes."
exit 0
fi
fi
BRANCH="chore/visual-baselines-${GITHUB_RUN_ID}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH"
git add tests/e2e/__screenshots__
git commit -m "test(e2e): refresh linux visual baselines"
git push origin "$BRANCH"
gh pr create --title "test(e2e): refresh linux visual baselines" \
--body "Automated baseline refresh from the update-visual-baselines workflow. Review the image diffs before merging." \
--base main --head "$BRANCH"