ci: fix api-docs workflow

`git diff-index` only works for tracked files, and unchanged
documentation files counts as untracked when shallow cloning.
This commit is contained in:
dundargoc 2023-11-27 11:35:19 +01:00 committed by dundargoc
parent 38a20dd89f
commit 5b765fcab4

View File

@ -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