Skip to content

Commit dfcd7e7

Browse files
Merge pull request #45 from stephenswat/workflow/checked_out_actions
Make Github Actions work for checked out repositories
2 parents 8159649 + 5398fdd commit dfcd7e7

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

.github/check_format.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
#
33
# check that all code complies w/ the clang-format specification
44
#
@@ -7,6 +7,7 @@
77

88
set -e # abort on error
99

10+
INCLUDE_DIRS=(core examples io tests)
1011

1112
if [ $# -ne 1 ]; then
1213
echo "wrong number of arguments"
@@ -20,23 +21,19 @@ _binary=${CLANG_FORMAT_BINARY:-clang-format}
2021
$_binary --version
2122

2223
cd $1
23-
find . \( -iname '*.cpp' -or -iname '*.hpp' -or -iname '*.ipp' -or -iname '*.cu' -or -iname '*.cuh' -or -iname '*.hip' -or -iname '*.sycl' \) \
24-
-and -not -path "./*build*/*" \
25-
-and -not -path "./thirdparty/*" \
26-
| xargs $_binary -i -style=file
27-
24+
$_binary -i -style=file $(find ${INCLUDE_DIRS} \( -iname '*.cpp' -or -iname '*.hpp' -or -iname '*.ipp' -or -iname '*.cu' -or -iname '*.cuh' -or -iname '*.hip' -or -iname '*.sycl' \))
2825

2926
if ! [ -z $CI ] || ! [ -z $GITHUB_ACTIONS ]; then
3027
mkdir changed
31-
for f in $(git diff --name-only); do
28+
for f in $(git diff --name-only -- ${INCLUDE_DIRS[@]/#/:/}); do
3229
cp --parents $f changed
3330
done
3431
fi
3532

3633
echo "clang-format done"
3734

3835
set +e
39-
git diff --exit-code --stat
36+
git diff --exit-code --stat -- ${INCLUDE_DIRS[@]/#/:/}
4037
result=$?
4138

4239
if [ "$result" -eq "128" ]; then

0 commit comments

Comments
 (0)