Skip to content

Commit 84bbe54

Browse files
chore: speed up prebuild checkout with blobless partial clone (#9684)
* chore: speed up prebuild checkout with blobless partial clone The prebuild job checkout (fetch-depth: 0) was intermittently timing out on release builds where two parallel instances contend for git bandwidth. PR/dev checkouts are consistently ~40-45s, but release launcher checkouts hit 2-10 min in 4 of the last 7 releases. Changes: - Bump timeout-minutes 10 -> 20 as a safety net - Add filter: blob:none (blobless partial clone) to keep the full commit graph and tags for git describe --tags while skipping the expensive blob download - Skip checkout entirely for release builds where version is supplied (no prebuild step needs the repo on that path) - Guard changed-files behind pull_request event check (its output is unused for non-PR triggers) - Guard Debug Commit SHA behind the same checkout condition * chore: deduplicate checkout predicate into a plan step Address reviewer nit: the checkout condition was repeated in three places (Checkout, Debug Commit SHA, Get version) with slightly different formulations. Add a Plan checkout step that writes checkout=true/false to GITHUB_OUTPUT, then reference steps.plan.outputs.checkout from all three consumers. This makes the coupling explicit and prevents drift that would surface as an opaque action.yml-not-found error.
1 parent 1debbcb commit 84bbe54

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

.github/workflows/build-unitycloud.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ jobs:
209209
prebuild:
210210
name: Prebuild
211211
runs-on: ubuntu-latest
212-
timeout-minutes: 10
212+
timeout-minutes: 20
213213
# Skip when PR has 'perf_test' label (only performance tests should run)
214214
if: |
215215
!contains(github.event.pull_request.labels.*.name, 'perf_test') && (
@@ -255,12 +255,24 @@ jobs:
255255
install_source: ${{ steps.set_defaults.outputs.install_source }}
256256
targets: ${{ steps.get_targets.outputs.targets }}
257257
steps:
258+
- name: Plan checkout
259+
id: plan
260+
run: |
261+
if [[ "${{ github.event_name }}" == "pull_request" ]] || { [[ -z "${{ github.event.inputs.version }}" ]] && [[ -z "${{ inputs.version }}" ]]; }; then
262+
echo "checkout=true" >> "$GITHUB_OUTPUT"
263+
else
264+
echo "checkout=false" >> "$GITHUB_OUTPUT"
265+
fi
266+
258267
- name: Checkout code
268+
if: steps.plan.outputs.checkout == 'true'
259269
uses: actions/checkout@v6
260270
with:
261271
fetch-depth: 0
272+
filter: blob:none
262273

263274
- name: Detect changes under Explorer/**
275+
if: github.event_name == 'pull_request'
264276
id: changed_explorer
265277
uses: step-security/changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45.0.1
266278
with:
@@ -353,15 +365,15 @@ jobs:
353365
fi
354366
355367
- name: Debug Commit SHA
356-
if: steps.decide.outputs.should_build == 'true'
368+
if: steps.decide.outputs.should_build == 'true' && steps.plan.outputs.checkout == 'true'
357369
run: |
358370
echo "Ref from Pull Request: ${{ github.event.pull_request.head.sha }}"
359371
echo "Full Commit from git rev-parse: $(git rev-parse $GITHUB_SHA)"
360372
echo "HEAD Commit: $(git rev-parse HEAD)"
361373
362374
- name: Get version
363375
id: get_version
364-
if: steps.decide.outputs.should_build == 'true' && github.event.inputs.version == '' && inputs.version == ''
376+
if: steps.decide.outputs.should_build == 'true' && steps.plan.outputs.checkout == 'true'
365377
uses: ./.github/actions/version
366378
with:
367379
commit_sha: ${{ steps.get_commit_sha.outputs.commit_sha }}

0 commit comments

Comments
 (0)