Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

ci: shallow-clone check-scope except for release-branch validation (#7448)

Cindy Zhang95509222de66
diff --git a/.github/scripts/release-check-workflow.test.mjs b/.github/scripts/release-check-workflow.test.mjs
index 1338f767d4..ceb7824ef1 100644
--- a/.github/scripts/release-check-workflow.test.mjs
+++ b/.github/scripts/release-check-workflow.test.mjs
@@ -664,6 +664,31 @@ describe('full release scope without PR metadata or maintenance writes', () => {
expect(result.stdout).not.toContain('AUDIT MUST NOT RUN');
});
+ it('clones full history only where the release-branch validator reads it', () => {
+ const checkout = jobs['check-scope'].steps.find(step =>
+ step.uses?.startsWith('actions/checkout@'),
+ );
+ const expression = String(checkout.with['fetch-depth']).replace(
+ /^\$\{\{\s*|\s*\}\}$/g,
+ '',
+ );
+ const depth = (event, branch, baseRef = '') =>
+ Function(
+ 'github',
+ 'inputs',
+ 'startsWith',
+ `return ${expression.replaceAll('==', '===').replaceAll('!===', '!==')};`,
+ )(
+ {event_name: event, base_ref: baseRef},
+ {'release-branch': branch},
+ (value, prefix) => String(value).startsWith(prefix),
+ );
+ expect(depth('workflow_dispatch', releaseBranch)).toBe('0');
+ expect(depth('pull_request', '', 'release/v0.6.5')).toBe('0');
+ expect(depth('workflow_dispatch', 'main')).toBe('50');
+ expect(depth('pull_request', '', 'main')).toBe('50');
+ });
+
it('keeps exhaustive a11y contracts and their artifacts release-only', () => {
for (const [job, name] of [
['a11y-contracts-shard', 'Run accessibility spec-test contracts'],
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f12eec3da8..597965505f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -72,10 +72,14 @@ jobs:
release_head: ${{ steps.release-authority.outputs.head || steps.main-authority.outputs.head }}
release_plan_digest: ${{ steps.release-authority.outputs.planDigest }}
steps:
+ # Full history only where the release-branch validator reads it (tags,
+ # the cut commit, release diffs). A PR's merge commit has the base tip
+ # as a parent, and a main pre-cut check fetches current main on top, so
+ # 50 commits are plenty there; the full clone took over a minute.
- uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
- fetch-depth: 0
+ fetch-depth: ${{ ((github.event_name == 'workflow_dispatch' && inputs['release-branch'] != 'main') || (github.event_name == 'pull_request' && startsWith(github.base_ref, 'release/v'))) && '0' || '50' }}
- name: Fetch active release refs
if: >-