Fix user reported exceptions #174
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Clang Format Check | |
on: | |
pull_request: | |
paths: | |
- 'Sources/**' | |
- 'Tests/**' | |
- 'Samples/Common/Sources/CrashTriggers/**' | |
- '.github/workflows/clang-format.yml' | |
- '.clang-format-ignore' | |
- 'Makefile' | |
jobs: | |
formatting-check: | |
name: Formatting Check | |
runs-on: ubuntu-latest | |
env: | |
DIRS: 'Sources Tests Samples/Common/Sources/CrashTriggers' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install clang-format-18 | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 18 | |
sudo apt-get install -y clang-format-18 | |
- name: Check formatting | |
id: check_format | |
run: | | |
make check-format 2>clang_format_errors.log | |
- name: Suggest formatting fixes | |
if: failure() | |
run: | | |
echo "##[error]Formatting issues found. Please run clang-format-18 on your code." | |
- name: Create summary and annotations | |
if: failure() | |
run: | | |
echo "### Formatting issues found" >> $GITHUB_STEP_SUMMARY | |
echo "Please run clang-format-18 on your code." >> $GITHUB_STEP_SUMMARY | |
echo "Note: Some files may be excluded from formatting based on .clang-format-ignore file." >> $GITHUB_STEP_SUMMARY | |
echo "::group::Formatting issues" | |
awk ' | |
/^.*error:/ { | |
split($0, parts, ":") | |
file=parts[1] | |
line=parts[2] | |
col=parts[3] | |
message=$0 | |
getline code_line | |
getline caret_line | |
sub(/:.*$/, "", file) | |
sub(/[^0-9]/, "", line) | |
sub(/[^0-9]/, "", col) | |
# Remove the "error: " prefix from the message | |
sub(/^[^:]+: [^:]+: [^:]+: /, "", message) | |
print "::error file="file",line="line",col="col"::"message | |
}' clang_format_errors.log | |
echo "::endgroup::" |