Skip to content

Commit 5b241e0

Browse files
committed
Add check format to the ci
1 parent b2bee5b commit 5b241e0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/ci.yml

+19
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,25 @@ jobs:
9999

100100
steps:
101101
- uses: actions/checkout@v4
102+
with:
103+
fetch-depth: 2
104+
105+
- name: Check CMake files format
106+
if: github.event_name == 'pull_request'
107+
run: |
108+
LIST_CHECK_FILES=$(git diff --name-only --diff-filter=d HEAD^1 HEAD | grep -E 'CMakeLists.txt$' | tr '\n' ' ')
109+
110+
echo "Changed files:"
111+
echo "$LIST_CHECK_FILES"
112+
if [[ -n ${LIST_CHECK_FILES} ]]
113+
then
114+
pip install cmake-format
115+
for FILE in $LIST_CHECK_FILES; do
116+
cmake-format --check $FILE
117+
done
118+
else
119+
echo "Nothing to check with cmake-format"
120+
fi
102121
103122
- name: Restore cached directories
104123
id: restore-cache

0 commit comments

Comments
 (0)