Skip to content

Commit cf31e9b

Browse files
committed
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>
1 parent 617e082 commit cf31e9b

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
@@ -54,7 +54,8 @@ jobs:
5454
steps:
5555
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5656
with:
57-
fetch-depth: 0
57+
# The first parent of the PR merge commit is the base branch commit.
58+
fetch-depth: 2
5859
persist-credentials: false
5960
- name: Use Node.js ${{ env.NODE_VERSION }}
6061
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
@@ -72,7 +73,7 @@ jobs:
7273
# because it is irrelevant. We already check if the formatter produced
7374
# a diff in the next line.
7475
# Refs: https://github.com/nodejs/node/pull/42764
75-
CLANG_FORMAT_START="$(git merge-base HEAD refs/remotes/origin/$GITHUB_BASE_REF)" \
76+
CLANG_FORMAT_START=HEAD^ \
7677
make format-cpp || true
7778
git --no-pager diff --exit-code && EXIT_CODE="$?" || EXIT_CODE="$?"
7879
if [ "$EXIT_CODE" != "0" ]

0 commit comments

Comments
 (0)