mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
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:
parent
a83c3bd61a
commit
a87a6e3b8c
5 changed files with 17 additions and 34 deletions
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
|
|
@ -2,10 +2,7 @@ name: Build
|
|||
on:
|
||||
pull_request:
|
||||
branches: [dev]
|
||||
workflow_run:
|
||||
workflows: [Formatter]
|
||||
types:
|
||||
- completed
|
||||
push:
|
||||
branches: [dev]
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
|
|
|
|||
28
.github/workflows/formatter.yml
vendored
28
.github/workflows/formatter.yml
vendored
|
|
@ -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.'
|
||||
Loading…
Add table
Add a link
Reference in a new issue