Commit c4af8665f62 for nodejs
commit c4af8665f6230541de568b5d4161d7707faf7332
Author: Yuya Inoue <65857152+inoway46@users.noreply.github.com>
Date: Mon Oct 5 20:25:21 2026 +0900
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: https://github.com/nodejs/node/pull/66479
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml
index 0ed28b111cd..9afdb2ef5a6 100644
--- a/.github/workflows/linters.yml
+++ b/.github/workflows/linters.yml
@@ -60,7 +60,8 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
- fetch-depth: 0
+ # The first parent of the PR merge commit is the base branch commit.
+ fetch-depth: 2
persist-credentials: false
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
@@ -78,7 +79,7 @@ jobs:
# because it is irrelevant. We already check if the formatter produced
# a diff in the next line.
# Refs: https://github.com/nodejs/node/pull/42764
- CLANG_FORMAT_START="$(git merge-base HEAD refs/remotes/origin/$GITHUB_BASE_REF)" \
+ CLANG_FORMAT_START=HEAD^ \
make format-cpp || true
git --no-pager diff --exit-code && EXIT_CODE="$?" || EXIT_CODE="$?"
if [ "$EXIT_CODE" != "0" ]