Skip to content

Commit c4af866

Browse files
authored
tools: limit format-cpp checkout history
Use the first parent of the PR merge commit as the formatting base, allowing a depth-two checkout instead of fetching the full history. Assisted-by: Codex Signed-off-by: inoway46 <inoueyuya416@gmail.com> PR-URL: #66479 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent 88ec314 commit c4af866

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎.github/workflows/linters.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ jobs:
6060
steps:
6161
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6262
with:
63-
fetch-depth: 0
63+
# The first parent of the PR merge commit is the base branch commit.
64+
fetch-depth: 2
6465
persist-credentials: false
6566
- name: Use Node.js ${{ env.NODE_VERSION }}
6667
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
@@ -78,7 +79,7 @@ jobs:
7879
# because it is irrelevant. We already check if the formatter produced
7980
# a diff in the next line.
8081
# Refs: https://github.com/nodejs/node/pull/42764
81-
CLANG_FORMAT_START="$(git merge-base HEAD refs/remotes/origin/$GITHUB_BASE_REF)" \
82+
CLANG_FORMAT_START=HEAD^ \
8283
make format-cpp || true
8384
git --no-pager diff --exit-code && EXIT_CODE="$?" || EXIT_CODE="$?"
8485
if [ "$EXIT_CODE" != "0" ]

0 commit comments

Comments
 (0)