From 0597ab622a0f9be00b98641b70b463b44599f164 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Sat, 28 Sep 2024 15:14:02 +0200 Subject: [PATCH] [Build] Make staging of relevant files robust against file absence Stage the relevant kind of files in isolation and don't fail if that kind of file does not exist at all in the repository. Otherwise the entire step fails if the repo for example doesn't contain a feature.xml, because the previous 'git add' command then fails with: fatal: pathspec '*/feature.xml' did not match any files --- .github/workflows/checkVersions.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checkVersions.yml b/.github/workflows/checkVersions.yml index 80788e560e8..8e8f674557c 100644 --- a/.github/workflows/checkVersions.yml +++ b/.github/workflows/checkVersions.yml @@ -49,7 +49,10 @@ jobs: - name: Commit version increments, if any run: | set -x - git add '*/META-INF/MANIFEST.MF' '*/feature.xml' '*/pom.xml' + # Only stage files relevant for version increments and don't fail if the kind of file to be staged does not exist at all. + git add '*/META-INF/MANIFEST.MF' || true + git add '*/feature.xml' || true + git add '*/pom.xml' || true if [[ $(git diff --name-only --cached) != '' ]]; then # Relevant files were staged, i.e. some version were changed