feature: apply main arguments #89
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: 'Format code' | |
on: | |
push: | |
branches: | |
- Master | |
- develop | |
paths: | |
- '**.c' | |
- '**.h' | |
jobs: | |
clang-format: | |
name: Format code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install clang-format (formatter tool) | |
run: sudo apt-get install clang-format | |
- name: Run clang-format | |
run: find . -name '*.c' -o -name '*.h' | xargs clang-format -i -style=file | |
- name: Commit changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add . | |
git diff-index --quiet HEAD || git commit -m "ci: format code" | |
- name: Push changes | |
uses: ad-m/[email protected] | |
with: | |
branch: ${{ github.ref }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} |