trying to run formatting automatically #5
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 | |
on: | |
pull_request: | |
jobs: | |
format: | |
name: Run Clang-Format | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Install Clang-Format | |
run: sudo apt-get update && sudo apt-get install clang-format | |
- name: Run Clang-Format | |
run: | | |
# Format all relevant files in the repository | |
find include -type f \( -name '*.hpp' -o -name '*.h' \) -exec clang-format -i --style=file {} + | |
find src -type f \( -name '*.cu' -o -name '*.hpp' -o -name '*.h' -o -name '*.cpp' \) -exec clang-format -i --style=file {} + | |
find test -type f \( -name '*.hpp' -o -name '*.h' -o -name '*.cpp' \) -exec clang-format -i --style=file {} + | |
- name: Commit changes | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
git commit -am "Auto-format code using Clang-Format" || echo "No changes to commit" |