File tree Expand file tree Collapse file tree
devops/actions/clang-format Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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'
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
Original file line number Diff line number Diff 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 :
You can’t perform that action at this time.
0 commit comments