Skip to content

Commit b3af755

Browse files
[Github] Set start rev to merge base in code format action (#75132)
This patch sets the start revision to the merge base so that the c++ formatting action won't produce any diffs related to changes in main but not in the PR branch. This also leaves a TODO to migrate over to the --diff_from_common_commit option in git-clang-format once LLVM v18 is released.
1 parent 41a3828 commit b3af755

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/workflows/pr-code-format.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ jobs:
6767
START_REV: ${{ github.event.pull_request.base.sha }}
6868
END_REV: ${{ github.event.pull_request.head.sha }}
6969
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
70+
# TODO(boomanaiden154): Once clang v18 is released, we should be able
71+
# to take advantage of the new --diff_from_common_commit option
72+
# explicitly in code-format-helper.py and not have to diff starting at
73+
# the merge base.
7074
run: |
7175
python ./code-format-tools/llvm/utils/git/code-format-helper.py \
7276
--token ${{ secrets.GITHUB_TOKEN }} \
7377
--issue-number $GITHUB_PR_NUMBER \
74-
--start-rev $START_REV \
78+
--start-rev $(git merge-base $START_REV $END_REV) \
7579
--end-rev $END_REV \
7680
--changed-files "$CHANGED_FILES"

0 commit comments

Comments
 (0)