File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -59,19 +59,17 @@ jobs:
59
59
run : |
60
60
# Store the changes in a patch file first
61
61
git diff > clang-format-changes.patch
62
- # Print the changes to the console
63
- cat clang-format-changes.patch
64
62
# 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
70
67
exit 1
71
68
fi
72
69
- name : Upload artifacts
73
70
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()
75
73
with :
76
74
name : clang-format-changes.patch
77
75
path : |
You can’t perform that action at this time.
0 commit comments