diff --git a/src/github.ts b/src/github.ts index fad8b6f4..335a9fd3 100644 --- a/src/github.ts +++ b/src/github.ts @@ -15,11 +15,14 @@ export const reactionTypes: ReactionID[] = ['+1', '-1', 'laugh', 'hooray', 'conf let owner: string; let repo: string; -const branch = 'master'; +let branch = 'master'; -export function setRepoContext(context: { owner: string; repo: string; }) { +export function setRepoContext(context: { owner: string; repo: string; branch?: string; }) { owner = context.owner; repo = context.repo; + if (context.branch) { + branch = context.branch; + } } function githubRequest(relativeUrl: string, init?: RequestInit) { diff --git a/src/page-attributes.ts b/src/page-attributes.ts index 64783325..c88da6a4 100644 --- a/src/page-attributes.ts +++ b/src/page-attributes.ts @@ -51,7 +51,8 @@ function readPageAttributes() { description: params.description, label: params.label, theme: params.theme || 'github-light', - session: params.session + session: params.session, + branch: params.branch || 'master' }; } diff --git a/src/utterances.ts b/src/utterances.ts index 588bf08b..9a3b78a7 100644 --- a/src/utterances.ts +++ b/src/utterances.ts @@ -138,7 +138,7 @@ async function renderComments(issue: Issue, timeline: TimelineComponent) { export async function assertOrigin() { const { origins } = await getRepoConfig(); - const { origin, owner, repo } = page; + const { origin, owner, repo, branch } = page; if (origins.indexOf(origin) !== -1) { return; } @@ -147,7 +147,7 @@ export async function assertOrigin() {
Error: ${origin} is not permitted to post to ${owner}/${repo}. Confirm this is the correct repo for this site's comments. If you own this repo, - + update the utterances.json to include ${origin} in the list of origins.