From aa64f07ff0edd0b963df617533a626d1ac37504b Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 13:11:16 +0300 Subject: [PATCH] Do not fail the screenshot recording job when there is nothing to commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit recordScreenshots.sh runs under `set -e`, and the `git commit -m "Update screenshots"` at the end of it is unconditional. When a recording run produces no diff — the common case once the snapshots are already up to date — `git commit` exits 1 with "nothing to commit, working tree clean" and takes the whole workflow down with it, reporting a red job for a successful run. Stage as before, then return early when the staged diff is empty. `set -e` is left in place: it was added deliberately so that a failed Gradle run cannot push a commit that deletes every snapshot. Using `git diff --cached --quiet` as an `if` condition is `set -e`-safe, because its non-zero "there are changes" status is consumed by the condition. The early return also skips the push, which had nothing to send. --- .github/workflows/scripts/recordScreenshots.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/scripts/recordScreenshots.sh b/.github/workflows/scripts/recordScreenshots.sh index d29353a2c2..d04ee46f72 100755 --- a/.github/workflows/scripts/recordScreenshots.sh +++ b/.github/workflows/scripts/recordScreenshots.sh @@ -78,6 +78,10 @@ else git config --local user.name "${INPUT_AUTHOR_EMAIL}" fi git add -A +if git diff --cached --quiet; then + echo "Screenshots are already up to date, nothing to commit." + exit 0 +fi git commit -m "Update screenshots" GITHUB_REPO="https://$GITHUB_ACTOR:$TOKEN@github.com/$REPO.git"