From 295dc85ca0d8d478889a34f296a1fb4aa844f2dc Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 31 May 2022 11:25:03 +0300 Subject: [PATCH] github: use git-clang-format instead of make indent This allows us to only detect bad formating in PR changes but not all the CRIU codebase. Signed-off-by: Pavel Tikhomirov --- .github/workflows/lint.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c3886c707..d32403d05 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,7 +9,7 @@ jobs: image: registry.fedoraproject.org/fedora:latest steps: - name: Install tools - run: sudo dnf -y install git make python3-flake8 ShellCheck clang-tools-extra which findutils codespell + run: sudo dnf -y install git make python3-flake8 ShellCheck clang-tools-extra which findutils codespell git-clang-format - uses: actions/checkout@v2 @@ -22,7 +22,12 @@ jobs: - name: Run make indent run: > - make indent && + if [ -z "${{github.base_ref}}" ]; then + make indent + else + git fetch origin ${{github.base_ref}} && + git clang-format --style file --extensions c,h --quiet origin/${{github.base_ref}} + fi && STATUS=$(git status --porcelain) && if [ ! -z "$STATUS" ]; then echo "FAIL: some files are not correctly formatted.";