Skip to content

Commit c6a9eee

Browse files
[CI] Another attempt to fix lint task (#9885)
1 parent 3d866f2 commit c6a9eee

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

.github/workflows/sycl_precommit.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
steps:
4040
- uses: actions/checkout@v3
4141
with:
42-
ref: ${{ github.event.pull_request.merge_commit_sha }}
4342
sparse-checkout: |
4443
devops/actions/cached_checkout
4544
- name: 'PR commits + 2'
@@ -48,10 +47,7 @@ jobs:
4847
with:
4948
path: src
5049
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
51-
# clang-format uses github.event.pull_request.base.sha that has the top
52-
# of the base branch, not the merge base. As such, checkout the merge
53-
# commit instead of github.event.pull_request.head.sha.
54-
ref: ${{ github.event.pull_request.merge_commit_sha }}
50+
ref: ${{ github.event.pull_request.head.sha }}
5551
cache_path: "/__w/repo_cache/"
5652
merge: false
5753
- name: Run clang-format

devops/actions/clang-format/action.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ runs:
1212
shell: bash {0}
1313
run: |
1414
git config --global --add safe.directory ${{ inputs.path }}
15-
git -C ${{ inputs.path }} clang-format ${{ github.event.pull_request.base.sha }}
15+
# TODO: Should we just drop fetch-depth in the cached checkout?
16+
base=$(git -C ${{ inputs.path }} merge-base ${{ github.event.pull_request.base.sha }} HEAD)
17+
echo "::group::Debug"
18+
echo "HEAD:"
19+
git -C ${{ inputs.path }} log -1 HEAD
20+
echo "Merge-base:"
21+
git -C ${{ inputs.path }} log -1 $base
22+
echo "::endgroup::"
23+
git -C ${{ inputs.path }} clang-format $base
1624
git -C ${{ inputs.path }} diff > ./clang-format.patch
17-
- name: Debug
18-
shell: bash
19-
run: |
20-
git -C ${{ inputs.path }} log ${{ github.event.pull_request.base.sha }}..HEAD
21-
git -C ${{ inputs.path }} diff ${{ github.event.pull_request.base.sha }}..HEAD
2225
# Add patch with formatting fixes to CI job artifacts
2326
- uses: actions/upload-artifact@v1
2427
with:

0 commit comments

Comments
 (0)