diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 4504f389d05a6..c1b4ea99066fd 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -11,17 +11,14 @@ jobs: steps: - uses: actions/checkout@v2 with: - # checkout PR head - ref: '${{github.event.pull_request.head.sha}}' - - name: Fetch target branch - run: git fetch --no-tags --prune --depth=1 origin +refs/heads/${{github.base_ref}}:refs/remotes/origin/${{github.base_ref}} + fetch-depth: 2 - name: Get clang-format first run: sudo apt-get install -yqq clang-format-9 - name: Run clang-format for the patch run: | - git diff -U0 --no-color origin/${{github.base_ref}}...HEAD | ./clang/tools/clang-format/clang-format-diff.py -p1 -binary clang-format-9 > ./clang-format.patch + git diff -U0 --no-color ${GITHUB_SHA}^1 ${GITHUB_SHA} -- | ./clang/tools/clang-format/clang-format-diff.py -p1 -binary clang-format-9 > ./clang-format.patch # Add patch with formatting fixes to CI job artifacts - uses: actions/upload-artifact@v1