Skip to content

Commit f430564

Browse files
committed
chore: remove unused baseBranch()
1 parent 3070390 commit f430564

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

server/utils/content.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ export async function createSourceContent(
7777
return instance
7878
}
7979

80-
/** Production branch, resolved per request: content pushes skip redeploys (`vercel.json` `ignoreCommand`). */
81-
export function targetBranch(): string {
82-
return process.env.VERCEL_GIT_COMMIT_REF || useRuntimeConfig().docs.github.branch || 'main'
83-
}
84-
8580
// The content commit this instance is pinned to. Pinning GitHub reads to an immutable SHA rather
8681
// than the branch name bypasses the stale `raw.githubusercontent.com/<branch>` CDN.
8782
let headRef: string | undefined

server/utils/github.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ export function githubToken(): string | undefined {
3939
return docs.githubToken || process.env.GITHUB_TOKEN || undefined
4040
}
4141

42+
/** Production branch, resolved per request: content pushes skip redeploys (`vercel.json` `ignoreCommand`). */
43+
export function targetBranch(): string {
44+
return process.env.VERCEL_GIT_COMMIT_REF || useRuntimeConfig().docs.github.branch || 'main'
45+
}
46+
4247
// Branch + content directory → content commit SHA pointer, shared across every instance so only one
4348
// pays for the GitHub API call per TTL window. See `refCacheDriver()` for the single-region assumption.
4449
const refStorage = createStorage({ driver: refCacheDriver() })
@@ -143,11 +148,6 @@ function pullAllowsPreview(pull: GitHubPullSummary): boolean {
143148
return (pull.labels ?? []).some((label) => label.name === PREVIEW_LABEL)
144149
}
145150

146-
/** The branch production serves — same resolution as `targetBranch()`, inlined to keep this module standalone. */
147-
function baseBranch(): string {
148-
return process.env.VERCEL_GIT_COMMIT_REF || useRuntimeConfig().docs.github.branch || 'main'
149-
}
150-
151151
/**
152152
* Authorize a `/blob/:sha` preview and resolve it to the full 40-char SHA.
153153
*
@@ -200,7 +200,7 @@ export async function authorizePreviewSha(sha: string): Promise<string> {
200200
if (!allowed) {
201201
try {
202202
const comparison = await $fetch<{ status: string }>(
203-
`https://api.github.com/repos/${githubRepo()}/compare/${encodeURIComponent(baseBranch())}...${fullSha}`,
203+
`https://api.github.com/repos/${githubRepo()}/compare/${encodeURIComponent(targetBranch())}...${fullSha}`,
204204
{ headers: githubHeaders() }
205205
)
206206
allowed = comparison.status === 'identical' || comparison.status === 'behind'

0 commit comments

Comments
 (0)