From 5b765fcab42308cd4d97a4c37da0c2b1cdb3514d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 11:35:19 +0100 Subject: [PATCH] ci: fix api-docs workflow `git diff-index` only works for tracked files, and unchanged documentation files counts as untracked when shallow cloning. --- .github/workflows/api-docs.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/api-docs.yml b/.github/workflows/api-docs.yml index 2cecd2af6d..6f8fe107d2 100644 --- a/.github/workflows/api-docs.yml +++ b/.github/workflows/api-docs.yml @@ -27,11 +27,8 @@ jobs: - name: Generate docs run: | make doc - printf 'UPDATED_DOCS=%s\n' $([ -z "$(git diff)" ]; echo $?) >> $GITHUB_OUTPUT - - - name: FAIL, PR has not committed doc changes - if: ${{ steps.docs.outputs.UPDATED_DOCS != 0 }} - run: | - echo "Job failed, run 'make doc' and commit your doc changes." - echo "The doc generation produces the following changes:" - git diff --color --exit-code + if [ -n "$(git status --porcelain)" ]; then + echo "::error::Job failed, run 'make doc' and commit your doc changes." + echo "::error::The doc generation produces the following changes:" + git diff --color --exit-code + fi