[mdBook template]: Fix issue causing mdBook pipeline to return failure when pushing changes that don't modify the mdBook (#88)

`git commit` returns 1 if there is nothing to commit, meaning that if you `git push` any changes that don't modify the mdBook, `git` will return failure because there is nothing to commit, causing the pipeline to return failure.
Adding a basic `git diff` check resolves this issue.

Reviewed-on: https://codeberg.org/Codeberg-CI/examples/pulls/88
Reviewed-by: crapStone <codeberg@crapstone.dev>
Co-authored-by: carnivorecookies <carnivorecookies@noreply.codeberg.org>
Co-committed-by: carnivorecookies <carnivorecookies@noreply.codeberg.org>
This commit is contained in:
carnivorecookies 2025-04-20 18:37:13 +00:00 committed by crapStone
parent 139788d318
commit fdb4c09d70

View File

@ -49,5 +49,4 @@ steps:
- cp .domains $CI_REPO_NAME || true - cp .domains $CI_REPO_NAME || true
- cd $CI_REPO_NAME - cd $CI_REPO_NAME
- git add . - git add .
- git commit -m "Woodpecker CI ${CI_BUILD_CREATED}" - if ! git diff --cached --quiet; then git commit -m "Woodpecker CI ${CI_BUILD_CREATED}" && git push; fi
- git push