Skip to content

Commit

Permalink
Merge pull request #8226 from quarto-dev/gh-pages-error
Browse files Browse the repository at this point in the history
Correctly place the error about gh-pages being required for github pages deployment
  • Loading branch information
dragonstyle authored Jan 11, 2024
2 parents 2798306 + c1fb5d6 commit 6bd98d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/command/publish/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
publishRecordIdentifier,
readAccountsPublishedTo,
} from "../../publish/common/data.ts";
import { kGhpages } from "../../publish/gh-pages/gh-pages.ts";

export async function resolveDeployment(
options: PublishOptions,
Expand Down Expand Up @@ -84,7 +85,7 @@ export async function resolveDeployment(
}
} else {
return await chooseDeployment(deployments);
}
}
} else if (deployments.length === 1) {
return deployments[0];
} else {
Expand All @@ -95,7 +96,12 @@ export async function resolveDeployment(
} else if (!options.prompt) {
// if we get this far then an existing deployment has not been chosen,
// if --no-prompt is specified then this is an error state
if (!options.prompt) {
if (providerFilter === kGhpages) {
// special case for gh-pages where no _publish.yml is required but a gh-pages branch is
throw new Error(
`Unable to publish to GitHub Pages (the remote origin does not have a branch named "gh-pages". Use first \`quarto publish gh-pages\` locally to initialize the remote repository for publishing.)`,
);
} else {
throw new Error(
`No _publish.yml file available (_publish.yml specifying a destination required for non-interactive publish)`,
);
Expand Down
4 changes: 0 additions & 4 deletions src/publish/gh-pages/gh-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ async function publishRecord(
id: "gh-pages",
url: ghContext.siteUrl || ghContext.originUrl,
};
} else {
throwUnableToPublish(
'the remote origin does not have a branch named "gh-pages". Use first `quarto publish gh-pages` locally to initialize the remote repository for publishing.',
);
}
}

Expand Down

0 comments on commit 6bd98d0

Please sign in to comment.