From 8c6a56ce817103cc120e582b506486b0ac16c35c Mon Sep 17 00:00:00 2001 From: Jaehyun Lim Date: Tue, 21 Jul 2026 10:50:32 -0700 Subject: [PATCH] fix(ci): skip commit when API ref generation produces no changes The gen-ref-pages workflow's "Push changes" step ran `git commit` unconditionally after `git add src/`. When `pnpm run generate` produced no changes under src/, nothing was staged and `git commit` exited 1, failing the job under `set -e`. Guard the commit with `git diff --cached --quiet ||` so an empty diff is a clean no-op. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/gen-ref-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gen-ref-pages.yml b/.github/workflows/gen-ref-pages.yml index ab83b21c..ee8cf048 100644 --- a/.github/workflows/gen-ref-pages.yml +++ b/.github/workflows/gen-ref-pages.yml @@ -52,7 +52,7 @@ jobs: git config --global user.email "devops@withampersand.com" git config --global user.name "Ampersand Ops" git add src/ - git commit -m "[ampersand-ops] auto: update documentation with latest api reference" + git diff --cached --quiet || git commit -m "[ampersand-ops] auto: update documentation with latest api reference" git remote set-url origin https://x-access-token:${{ secrets.AMPERSAND_OPS_PAT }}@github.com/${{ github.repository }} git push origin HEAD:main env: