Skip to content

Clang-format action

Clang-format action #2

name: clang-format
on:
pull_request:
paths:
- '**.c'
- '**.cpp'
- '**.h'
- '**.hpp'
jobs:
clang-format-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install clang-format
run: |
sudo apt-get install -y clang-format
- name: Get changed files
id: get_files
run: |
git diff --name-only HEAD^ HEAD > changed_files.txt
- name: Run clang-format
run: |
xargs -a changed_files.txt -d '\n' git-clang-format --style=file -verbose -diff