File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 : |
You can’t perform that action at this time.
0 commit comments