Skip to content

Commit 34e4bf6

Browse files
hjmjohnsonCopilot
andauthored
Check failed clang-format version
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f87aa5a commit 34e4bf6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ runs:
2323
"https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/${ITK_BRANCH}/.pre-commit-config.yaml" \
2424
-o ITK.pre-commit-config.yaml
2525
CLANG_FORMAT_VERSION=$(grep -A 1 "mirrors-clang-format" ITK.pre-commit-config.yaml | tail -n 1 | cut -d: -f2 | tr -d ' v')
26+
if [ -z "${CLANG_FORMAT_VERSION}" ]; then
27+
echo "::error::Unable to determine clang-format version from ITK .pre-commit-config.yaml for branch '${ITK_BRANCH}'. The expected mirrors-clang-format revision entry was not found or could not be parsed."
28+
rm -f ITK.pre-commit-config.yaml
29+
exit 1
30+
fi
31+
if ! [[ "${CLANG_FORMAT_VERSION}" =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
32+
echo "::error::Invalid clang-format version parsed from ITK .pre-commit-config.yaml for branch '${ITK_BRANCH}': '${CLANG_FORMAT_VERSION}'. Expected a numeric version such as '18.1.8'."
33+
rm -f ITK.pre-commit-config.yaml
34+
exit 1
35+
fi
2636
echo "clang_format_version=${CLANG_FORMAT_VERSION}" >> $GITHUB_OUTPUT
2737
echo "use_pixi=true" >> $GITHUB_OUTPUT
2838
echo "Detected clang-format version: ${CLANG_FORMAT_VERSION}"

0 commit comments

Comments
 (0)