Skip to content

Commit e76c877

Browse files
scuttletobyclaude
andcommitted
fork-checks: full checkout of the default branch, so the check does not fetch blobs one by one
A sparse checkout left every blob the check reads to a separate lazy fetch from the partial clone (about 170 round trips on the real tree), close to the job's five-minute timeout. A full checkout fetches the default branch's blobs in one batch, as actions/checkout did before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 936e8c7 commit e76c877

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

‎.github/scripts/fork-schema-check.test.cjs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,6 @@ test("e2e: the workflow's checkout works on a tree with gitlinks and no .gitmodu
11651165
assert.equal(git("rev-parse", "HEAD"), main, "the default branch is checked out, not the PR");
11661166
assert.equal(git("cat-file", "-t", pr), "commit", "the PR head is fetched as objects");
11671167
assert.ok(fs.existsSync(path.join(run.dir, CHECK_FILES[0])));
1168-
assert.ok(!fs.existsSync(path.join(run.dir, "apps")), "only .github and root files");
11691168

11701169
// Fail closed: a commit the remote does not have stops the job.
11711170
const missing = runCheckoutStep(origin, {

‎.github/workflows/fork-checks.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
steps:
2323
# Plain git, not actions/checkout: upstream's tree has gitlinks under .repos/ but no
2424
# .gitmodules, and checkout's credential cleanup runs `git submodule foreach`, which fails on
25-
# them. Nothing is authenticated (public repository) and only the default branch is checked out.
25+
# them. The full checkout fetches the default branch's blobs in one batch; a sparse one leaves
26+
# the check to fetch every blob it reads one at a time.
2627
- name: Check out the default branch and fetch the pull request's commits (not checked out)
2728
env:
2829
DEFAULT_SHA: ${{ github.sha }}
@@ -34,7 +35,6 @@ jobs:
3435
git remote add origin "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
3536
git fetch -q --no-tags --no-recurse-submodules --filter=blob:none origin \
3637
"$DEFAULT_SHA" "$BASE_SHA" "$HEAD_SHA"
37-
git sparse-checkout set --cone .github
3838
git checkout -q --detach "$DEFAULT_SHA"
3939
4040
- name: Test the check

0 commit comments

Comments
 (0)