Skip to content

Brodey/graph contd #115

Brodey/graph contd

Brodey/graph contd #115

Workflow file for this run

name: clang-format Check
on:
- pull_request
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install clang-format
run: sudo apt-get install -y clang-format
- name: Fetch base branch
run: >
git fetch origin ${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
- name: Run clang-format on diff
run: >
git diff --name-only origin/${{ github.base_ref }} | grep -E '\.(cpp|h|cu)$' > changed_files.txt || true
while read file; do
echo "Checking $file"
# Get diff in unified format
git diff origin/${{ github.base_ref }} -- $file | clang-format-diff -p1 -style=file > formatted.diff
if [ -s formatted.diff ]; then
echo "File $file is not properly formatted. Please run format on your code."
cat formatted.diff
exit 1
fi
done
- name: Show success message
if: success()
run: echo "All files are properly formatted!"