diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index f26dc11ce..696dd45b7 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -146,7 +146,7 @@ jobs: rsync --archive --checksum --itemize-changes "screenshots/screenshots-android-tenInchScreenshots/" fastlane/metadata/android/ rsync --archive --checksum --itemize-changes "screenshots/screenshots-ios/" fastlane/metadata/ios/ - - name: Commit screenshots to repository + - name: Commit screenshots to a dated branch env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -156,7 +156,9 @@ jobs: if git diff --staged --quiet; then echo "No new or changed screenshots to commit." else - BRANCH=$(git rev-parse --abbrev-ref HEAD) - git commit -m "Update screenshots" - git push origin HEAD:"${BRANCH}" + BRANCH="screenshots-$(date -u +%Y-%m-%d)" + git commit -m "Update screenshots" + # Force-push so a same-day re-run replaces that day's branch + git push --force origin HEAD:"${BRANCH}" + echo "Pushed screenshots to branch ${BRANCH}" fi \ No newline at end of file