From f33f8583b51f17e10d77707b2525f6e45f758a8f Mon Sep 17 00:00:00 2001 From: Yichen Jiang Date: Thu, 13 Aug 2026 21:20:28 +0800 Subject: [PATCH] fix(docs): point source links at public master --- .github/workflows/docs-pages.yml | 3 +++ scripts/project-doc-site.spec.ts | 12 +++++++++++- scripts/project-doc-site.ts | 12 +++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs-pages.yml b/.github/workflows/docs-pages.yml index 6336089a41..78bdafdf5b 100644 --- a/.github/workflows/docs-pages.yml +++ b/.github/workflows/docs-pages.yml @@ -23,6 +23,9 @@ permissions: env: PRIMARY_NODE_VERSION: '24' + # Projected source links target the public repository, whose history can + # differ from this workflow's source repository. + DOCS_REPOSITORY_REF: master # CI runs must never report to the production telemetry endpoint baked # into apps/cli/cordis.yml (AppCLIEntry disables the row when set). DSH_TELEMETRY_DISABLED: '1' diff --git a/scripts/project-doc-site.spec.ts b/scripts/project-doc-site.spec.ts index b5f5218de7..bacb6996ec 100644 --- a/scripts/project-doc-site.spec.ts +++ b/scripts/project-doc-site.spec.ts @@ -7,7 +7,7 @@ import { basename, join, resolve } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' import { docsPages, landingLink, routeLink, sectionSpec, type DocsPage } from '../website/docs.ts' import { - addProjectionFrontmatter, projectedPageContent, publishableImage, rewriteMarkdown, + addProjectionFrontmatter, projectedPageContent, publishableImage, resolveRepositoryRef, rewriteMarkdown, } from './project-doc-site.ts' const roots: string[] = [] @@ -91,6 +91,16 @@ describe('publishableImage', () => { }) }) +describe('resolveRepositoryRef', () => { + it('defaults to public master instead of a private workflow SHA', () => { + expect(resolveRepositoryRef({ GITHUB_SHA: 'private-sha' })).toBe('master') + }) + + it('accepts an explicit public repository ref', () => { + expect(resolveRepositoryRef({ DOCS_REPOSITORY_REF: 'public-sha' })).toBe('public-sha') + }) +}) + describe('rewriteMarkdown', () => { it('maps published pages and pins unpublished source links', () => { const { root, pages } = fixture() diff --git a/scripts/project-doc-site.ts b/scripts/project-doc-site.ts index 1d0ea9072a..9150780c14 100644 --- a/scripts/project-doc-site.ts +++ b/scripts/project-doc-site.ts @@ -19,6 +19,16 @@ const REPOSITORY_URL = 'https://github.com/deepseek-ai/deepseek-harness' const root = resolve(import.meta.dirname, '..') const generatedRoot = resolve(root, 'website/.generated') +/** + * Resolve the public repository ref used by projected source links. + * + * @param environment Build environment containing an optional explicit public ref. + * @returns The configured public ref, or `master`. + */ +export function resolveRepositoryRef(environment: NodeJS.ProcessEnv): string { + return environment.DOCS_REPOSITORY_REF ?? 'master' +} + interface Replacement { start: number end: number @@ -400,7 +410,7 @@ export function projectDocs(): void { const routes = new Set() /** Projected path to the repository file that claimed it, pages and images alike. */ const claimed = new Map() - const repositoryRef = process.env.GITHUB_SHA ?? 'master' + const repositoryRef = resolveRepositoryRef(process.env) rmSync(generatedRoot, { recursive: true, force: true }) /** Reserve one projected path, refusing a second source for it. */