File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed
devops/actions/clang-format Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 39
39
steps :
40
40
- uses : actions/checkout@v3
41
41
with :
42
- ref : ${{ github.event.pull_request.merge_commit_sha }}
43
42
sparse-checkout : |
44
43
devops/actions/cached_checkout
45
44
- name : ' PR commits + 2'
48
47
with :
49
48
path : src
50
49
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 }}
55
51
cache_path : " /__w/repo_cache/"
56
52
merge : false
57
53
- name : Run clang-format
Original file line number Diff line number Diff line change @@ -12,13 +12,16 @@ runs:
12
12
shell : bash {0}
13
13
run : |
14
14
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
16
24
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
22
25
# Add patch with formatting fixes to CI job artifacts
23
26
- uses : actions/upload-artifact@v1
24
27
with :
You can’t perform that action at this time.
0 commit comments