From e201339182fe691ca7f02d6e8dce90f2b822001a Mon Sep 17 00:00:00 2001 From: cpovirk Date: Tue, 16 Jun 2026 12:28:03 -0700 Subject: [PATCH] Make Javadoc CI jobs succeed when there is no change to the generated output. Truth's Javadoc-generation jobs has failed from [`d37a61a`](https://github.com/google/truth/commit/d37a61ab246f88363c32bf9fad87acc0eda057c1) onward. The trigger for the problem, however, is the commit _before_ that one, [`77c6a82`](https://github.com/google/truth/commit/77c6a8269bbf9033a609f5c380c891f7f82ec016): By upgrading to a new version of Javadoc, we put an end to [trivial changes to `.zip` files each time we regenerate the output](https://github.com/google/truth/commit/ea9b38737de26142c00601b81282ac9773e85a23) (likely timestamps or directory ordering, similar to the complaints I've had in https://github.com/google/guava/issues/7597). That meant that `git commit` started failing because there were no changes to the Javadoc output to commit after each of the recent changes to the code. (But the job for the Javadoc version itself succeeded because it naturally [did produce changes to the output](https://github.com/google/truth/commit/4feaa600f8e561b12cb6e7bdfef8b163274921d8).) The fix is to just exit successfully when there is nothing to commit. I'm preemptively making this same change to Auto. RELNOTES=n/a PiperOrigin-RevId: 933236220 --- util/generate-latest-docs.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/util/generate-latest-docs.sh b/util/generate-latest-docs.sh index 9ab501fc93..9c559d8c6d 100755 --- a/util/generate-latest-docs.sh +++ b/util/generate-latest-docs.sh @@ -19,7 +19,10 @@ git rm -rf api/latest mkdir -p api # Just to make mv work if the directory is missing mv ${TARGET}/reports/apidocs api/latest git add -A -f api/latest -git commit -m "Latest javadoc on successful CI build auto-pushed to gh-pages" -git push -fq origin gh-pages > /dev/null - -echo -e "Published Javadoc to gh-pages.\n" +if [ -n "$(git status --porcelain)" ]; then + git commit -m "Latest javadoc on successful CI build auto-pushed to gh-pages" + git push -fq origin gh-pages > /dev/null + echo "Published Javadoc to gh-pages." +else + echo "No changes to commit." +fi