Skip to content

GitHub

Push your artifact’s published files to a GitHub repository. Tokens are stored per artifact. Access via sdk.github.

const sdk = await ShareOut.create();
if (!await sdk.github.isConnected()) {
await sdk.github.authorize();
}
const result = await sdk.github.export({
repo: 'octocat/my-site',
commitMessage: 'Update from ShareOut',
});
console.log(result.repoUrl); // https://github.com/octocat/my-site
console.log(result.filesCommitted); // 3
authorize(returnUrl?): Promise<boolean>
isConnected(): Promise<boolean>
getStatus(): Promise<{ connected: boolean; username?: string; artifactId: string }>
disconnect(): Promise<void>
listRepos(options?): Promise<{ repos: Repo[]; page: number; perPage: number }>
export(options): Promise<ExportResult>
FieldRequiredDescription
repoOne of repo or newRepoExisting repo in owner/repo format
newRepo.nameOne of repo or newRepoName for a new repo to create
newRepo.descriptionNoRepository description
newRepo.privateNoPrivate repo (default: false)
branchNoTarget branch (default: main)
commitMessageNoCommit message (default: "ShareOut export v{version}")
includeReadmeNoGenerate a README with artifact info (default: true)
pathPrefixNoPrefix for all file paths, e.g. "dist/"

These endpoints are also available directly from agents or server code.

EndpointMethodDescription
/v1/data/{artifactIdOrSlug}/github/auth-urlGETReturns a GitHub OAuth URL
/v1/data/{artifactIdOrSlug}/github/token-statusGETConnection status and username
/v1/data/{artifactIdOrSlug}/github/disconnectPOSTRemove stored GitHub token
/v1/data/{artifactIdOrSlug}/github/reposGETList user’s repositories
/v1/data/{artifactIdOrSlug}/github/exportPOSTExport files to a repository

{artifactIdOrSlug} accepts either art_2ce7… or a deployment slug like my-site.

ParameterRequiredDescription
returnNoURL to redirect to after OAuth; callback appends ?github_connected=true
  • Tokens are stored per artifact, not per ShareOut user.
  • GitHub tokens do not expire unless revoked.
  • OAuth scope is repo (full repository access).
  • OAuth returns through https://shareout.site/auth/callback; ShareOut detects GitHub callbacks from the state parameter.
CodeMeaning
GITHUB_NOT_CONNECTEDNo token stored — call authorize() first
REPO_NOT_FOUNDRepository not found or not accessible
NO_DEPLOYMENTNo published version exists to export
NO_ASSETSNo files found in the deployment
INVALID_REQUESTBoth repo and newRepo missing from export body
EXPORT_ERRORGitHub API error during export