Skip to content

Commit d18f56c

Browse files
committed
Inform of auto-reformatter on failed clang-format
Creates a message in the Clang Format GitHub workflow's logs which directs the PR author to the auto-reformat trigger. Previously, people were not aware that they could run clang-format via writing a comment with the trigger. Hopefully, this message will be enough. Having the GitHub bot respond with a comment informing the PR author of this feature was considered, but it was dropped due to technical limitations in GitHub. A PR from a fork has a different GITHUB_TOKEN secret as the main repo, preventing the secret from being used to add a comment.
1 parent e671d40 commit d18f56c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.github/workflows/clangformat.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,14 @@ jobs:
1818
with:
1919
source: '.'
2020
clangFormatVersion: 9
21+
22+
- name: Report failure
23+
if: ${{ failure() }}
24+
run: |
25+
cat << EOF
26+
::error::Something is not properly formatted by clang-format.
27+
28+
::error::If you add a comment to your PR with exactly the text 'Do: Reformat' \
29+
(without the quotes), each commit of your PR will be reformatted for you.
30+
EOF
31+
exit 1

0 commit comments

Comments
 (0)