Merge pull request #12 from joanvallve/9-default-values-for-custom-cl… #8
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: [push, pull_request] | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install clang | |
run: sudo apt install -y clang-format-12 | |
- name: config git & temporary branch | |
run: | | |
if [ `git rev-parse --verify ci_processing 2>/dev/null` ]; then | |
git branch -D ci_processing | |
fi | |
git config --global user.email "[email protected]" | |
git config --global user.name "continuous integration" | |
git checkout -b ci_processing | |
- name: apply clang format | |
run: find . -iname *.h -o -iname *.cpp -o -iname *.hpp | xargs clang-format-12 --style=file -i | |
- name: push changes if any | |
run: | | |
if git commit -a -m "[skip ci] clang format" ; then | |
git push origin ci_processing:${BRANCH_NAME} | |
else | |
echo "No changes, nothing to commit!" | |
fi |