Skip to content

Commit 54bb28f

Browse files
authored
ci: don't fail update-snapshots when there are no changes (tldraw#9070)
The `update-snapshots` workflow regenerates Playwright snapshots and commits them via huppy-bot. When a run produces no snapshot changes, the `git commit` step failed with `nothing to commit, working tree clean` (exit 1), so the workflow reported a red ✗ even though nothing was wrong — there was simply nothing to update. This guards the commit step: if nothing is staged, it logs a message and exits 0 instead of attempting an empty commit. Runs that do produce snapshot changes still commit and push as before. ## Code changes | File | +/- | | --- | --- | | `.github/workflows/playwright-update-snapshots.yml` | +4 / −0 | ## Test plan - A label-triggered run with no snapshot diffs now completes green instead of failing on the empty commit. - A run that does produce snapshot changes still commits and pushes (the guard only short-circuits the empty case).
1 parent 4319206 commit 54bb28f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

.github/workflows/playwright-update-snapshots.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ jobs:
7171
git config --global user.name 'huppy-bot[bot]'
7272
git config --global user.email '128400622+huppy-bot[bot]@users.noreply.github.com'
7373
git add -A
74+
if git diff --cached --quiet; then
75+
echo 'No snapshot changes to commit.'
76+
exit 0
77+
fi
7478
git commit --no-verify -m '[automated] update snapshots'
7579
git add -A && git reset --hard HEAD # we sometimes get a dirty tree because husky makes changes for some reason
7680
git pull --rebase

0 commit comments

Comments
 (0)