Switch code formatter from auto-commit to pre-commit hook (#7386)

* Add pre-commit check for the code formatter

* Remove code formatter CI

* Fix mtime in fast-format command
This commit is contained in:
Riccardo Mori 2023-04-11 15:08:29 +02:00 committed by GitHub
parent a83c3bd61a
commit a87a6e3b8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 34 deletions

View file

@ -2,10 +2,7 @@ name: Build
on:
pull_request:
branches: [dev]
workflow_run:
workflows: [Formatter]
types:
- completed
push:
branches: [dev]
workflow_dispatch:
jobs:

View file

@ -1,28 +0,0 @@
# This workflow uses clang-format to force the right coding style.
name: Formatter
on:
push:
branches: [ "dev" ]
workflow_dispatch:
jobs:
formatter:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run formatter
run: find ./src ./include/ -type f \( -name '*.cpp' -o -name '*.h' \) -exec clang-format --style=file -i '{}' \;
# Commit the changes when pushing to a remote branch
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_user_name: clang-format-bot
commit_message: 'Automated commit of clang-format CI changes.'