forked from Tudat/tudat
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into develop
- Loading branch information
Showing
5 changed files
with
61 additions
and
5 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
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
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Clang-Format Check and Fix | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
format-check: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
persist-credentials: true | ||
|
||
- name: Install Clang-Format | ||
run: sudo apt-get install -y clang-format | ||
|
||
- name: Display Clang-Format Version | ||
run: clang-format --version | ||
|
||
- name: Identify Changed Files in Push | ||
run: | | ||
echo "Changed files in push:" | ||
git diff --name-only --diff-filter=ACM "${{ github.event.before }}" "${{ github.sha }}" | grep -E '\.(cpp|hpp|c|h)$' || echo "No matching files changed." | ||
- name: Run Clang-Format on Changed Files | ||
run: | | ||
git diff --name-only --diff-filter=ACM "${{ github.event.before }}" "${{ github.sha }}" | grep -E '\.(cpp|hpp|c|h)$' | xargs -r clang-format -style=file -i | ||
- name: Check for Formatting Differences | ||
id: check_diff | ||
run: | | ||
# This command will exit with a non-zero status if there are differences. | ||
git diff --exit-code | ||
continue-on-error: true | ||
|
||
- name: Auto-commit Formatting Changes | ||
if: failure() | ||
run: | | ||
git config --local user.name "github-actions[bot]" | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git add . | ||
git commit -m "Apply clang-format" | ||
# Strip the "refs/heads/" prefix to get the branch name. | ||
branch=${GITHUB_REF#refs/heads/} | ||
git push origin HEAD:"$branch" | ||
- name: Report Success or Failure | ||
run: | | ||
if [ "${{ steps.check_diff.outcome }}" == "failure" ]; then | ||
echo "Formatting issues were detected and fixed." | ||
else | ||
echo "Code is properly formatted." | ||
fi |
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
2.14.0.dev1 | ||
2.14.0.dev2 |