Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add clang-format to github action #2684

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Check Clang Format"

on: [push, pull_request]



jobs:
clang-format:
name: "Clang Formatter"
runs-on: ubuntu-latest
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
submodules: recursive

- name: Paths filter
uses: dorny/paths-filter@master
id: filter
with:
filters: |
file_changed:
- "**/*.cpp"
- "**/*.c"
- "**/*.h"
- "**/*.hpp"
- "**/*.cxx"


- name: "Format it!"
if: ${{ steps.filter.outputs.file_changed == 'true' }}
uses: DoozyX/clang-format-lint-action@master
id: check_format
with:
source: "./"
clangFormatVersion: 14
inplace: False
style: "file"

- name: Ignore it!
if: ${{ steps.filter.outputs.be_changes == 'false' }}
run: echo 'No need to check.'