Skip to content

Commit

Permalink
modify clang formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
BlaiseMuhirwa committed Dec 4, 2024
1 parent 5f165ee commit 8dea851
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,32 @@ jobs:
sudo apt-get install -y clang-format make
clang-format --version
- name: Check C++ source code formatting
run: |
make format-cpp
# Check if there are any changes after formatting
if ! git diff --quiet; then
echo "Formatting changes detected. Committing and pushing the changes."
# Set up git user for commit
git config user.name "GitHub Action Bot"
git config user.email "[email protected]"
# Add, commit, and push the changes
git add .
git commit -m "chore: auto-format C++ code via clang-format"
# Push to the current branch
git push origin HEAD:${{ github.head_ref || github.ref_name }}
else
echo "No formatting changes needed."
fi
run: |
make format-cpp
# Check if there are any changes after formatting
if ! git diff --quiet; then
echo "Formatting changes detected. Committing and pushing the changes."
# Set up git user for commit
git config user.name "GitHub Action Bot"
git config user.email "[email protected]"
# Add and commit the changes
git add .
git commit -m "chore: auto-format C++ code via clang-format"
# Fetch the latest changes from the remote
git fetch origin
# Rebase onto the latest remote branch
git rebase origin/${{ github.head_ref || github.ref_name }}
# Push the changes (force-with-lease to avoid overwriting unrelated changes)
git push --force-with-lease origin HEAD:${{ github.head_ref || github.ref_name }}
else
echo "No formatting changes needed."
fi
test-python-library:
Expand Down

0 comments on commit 8dea851

Please sign in to comment.