fix(docs): point source links at public master

This commit is contained in:
Yichen Jiang
2026-08-13 21:20:28 +08:00
parent fb82698709
commit f33f8583b5
3 changed files with 25 additions and 2 deletions

View File

@@ -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()