From 1a7442e0aa685ea7ab786e4f5b5703619e15c09e Mon Sep 17 00:00:00 2001 From: Ramiro Leal-Cavazos Date: Tue, 30 Jan 2024 19:59:46 -0800 Subject: [PATCH] Add clang-format check to CI (#2816) This PR adds a check to the CI right after checking out the Torch-MLIR repository to make sure that the changes in the PR don't require any `git clang-format` modifications. --- .github/workflows/lint.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 464ebdad9..364e9fa9d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,3 +1,4 @@ +# yamllint disable rule:line-length name: Lint Checks on: @@ -12,6 +13,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + # `git-clang-format` needs access to the commit before the + # current merge commit to know what changes to format. + fetch-depth: 2 - name: Validate GitHub Actions yaml files run: | yamllint ./.github/workflows/ ./.github/actions/ + - name: Check clang-format + run: | + wget -q https://raw.githubusercontent.com/llvm/llvm-project/main/clang/tools/clang-format/git-clang-format + python3 git-clang-format --diff HEAD~1