Skip to content

Commit 370a89c

Browse files
authored
Use GITHUB_SHA instead of GITHUB_REF (microsoft#5766)
Based on GitHubs docs, I think `GITHUB_SHA` will be the last commit from the target ref that is included in the PR's base ref. That should be the right compare point rather than `GITHUB_REF`, which would be the target branch's head ref. https://docs.github.com/en/actions/using-workflows/events-that-trigger-w orkflows#pull_request_target
1 parent 8c201e0 commit 370a89c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.github/workflows/clang-format-checker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
echo Comparing $PR_NUMBER vs target branch
2626
git fetch origin refs/pull/$PR_NUMBER/head:pull/$PR_NUMBER
2727
git checkout pull/$PR_NUMBER
28-
git diff -U0 --no-color $GITHUB_REF..pull/$PR_NUMBER | clang-format-diff-15 -p1 | tee format.diff
28+
git diff -U0 --no-color $GITHUB_SHA..pull/$PR_NUMBER | clang-format-diff-15 -p1 | tee format.diff
2929
if [ -s format.diff ]
3030
then
3131
echo PR contains clang-format violations. First 50 lines of the diff: >> message.txt

0 commit comments

Comments
 (0)