-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f165ee
commit 8dea851
Showing
1 changed file
with
26 additions
and
21 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|