Skip to content

Commit 60b4745

Browse files
committed
f
1 parent 10dbc32 commit 60b4745

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

.github/workflows/clang-format.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,17 @@ jobs:
5959
run: |
6060
# Store the changes in a patch file first
6161
git diff > clang-format-changes.patch
62-
# Print the changes to the console
63-
cat clang-format-changes.patch
6462
# if any changes were made, fail the build
65-
if git diff --quiet ; then
66-
# If no changes were made, delete the (empty) patch file, so it doesn't get posted as an artifact
67-
rm -f clang-format-changes.patch
68-
else
69-
echo "Code misformatted. Run clang-format or apply the patch to fix."
63+
if ! git diff --quiet ; then
64+
echo "::error::Code misformatted. Run clang-format or apply the patch to fix."
65+
# Print the changes to the console
66+
cat clang-format-changes.patch
7067
exit 1
7168
fi
7269
- name: Upload artifacts
7370
uses: actions/upload-artifact@v4
74-
if: always()
71+
# Only upload the patch file if the build failed, meaning that the code was not properly formatted
72+
if: failure()
7573
with:
7674
name: clang-format-changes.patch
7775
path: |

0 commit comments

Comments
 (0)