fix(ci): skip commit when API ref generation produces no changes#655
Open
jlimatampersand wants to merge 1 commit into
Open
fix(ci): skip commit when API ref generation produces no changes#655jlimatampersand wants to merge 1 commit into
jlimatampersand wants to merge 1 commit into
Conversation
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) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
gen-ref-pagesworkflow was failing on its Push changes step (e.g. run 29853466481).The step ran
git commitunconditionally aftergit add src/. Whenpnpm run generateproduced no changes undersrc/(the API reference was already up to date), nothing was staged, sogit commitexited with code 1 — and because the step shell runs underset -e, the whole job failed.Fix
Guard the commit so an empty staged diff is a clean no-op:
When there are generated changes, it commits and pushes as before. When there aren't, the commit is skipped and the subsequent
git pushjust reports "Everything up-to-date".🤖 Generated with Claude Code