GitHub

Send a published site to a repository of your own on GitHub, as a commit you can review, branch and build on.

With a GitHub account connected, a site can be pushed to a repository of yours. Each push is one commit on the repository's default branch.

Push a site to a repository

Push a published site to a new GitHub repository, in one click · 0:05
Description

A website that is published as Version 1, with a GitHub account connected. In the Publish dialog, under Also send to, New GitHub repository is clicked: a private repository named after the site is made in the account, added to the list, and the site is pushed to it at once. The row shows a link to the commit.

  1. Publish the site. A destination is sent a published version.
  2. In the Publish dialog, under Also send to, click New GitHub repository. A private repository named after the site is made under your account, and the published version is pushed to it at once.
  3. To use a repository you have, type in the field below the buttons: it lists every repository of every connected account. Pick one and the site is pushed there.

The row then links to the commit. Later versions go with Send version N; Add destination adds another.

What a push does

The commitOne commit on the default branch, on top of what is there. Its message names the version.
The filesThe same static site PopCraft hosts: a page of HTML per screen, site.json, the pc/ scripts, assets/.
Your other filesLeft alone. A README, a workflow, a CNAME: anything PopCraft did not write stays.
Files from an earlier pushReplaced, and removed when the site no longer has them. PopCraft keeps the list in .popcraft/files.json.
An empty repositoryGets a first commit (a README), then the site.

The repository is yours: turn on GitHub Pages, connect it to a host, or build on the code.

One account, many repositories

A connection is the account. Each file picks its own repository, so several files can use one connection, and you can connect a second GitHub account for another organization.

Ask the AI agent

Put this site in a new repository on my GitHub.

Push it to the brightside/website repository.

With no repository in mind, the agent makes one named after the site (create: true). Otherwise it lists what the account holds and asks which when there are several. It asks you to approve before it creates one or pushes.

ToolWhat it does
list_integration_resourcesThe owners, then the repositories, of a connected account.
add_site_destinationChoose a repository, or make one (create: true, or createNamed under an owner). Asks first.
deploy_sitePush a published version. Asks first.

Remove a destination

Click the bin beside it. PopCraft stops pushing there; the repository and its commits stay on GitHub.

When something goes wrong

What you seeWhat to do
Resource not accessible by integration or 403The token or app cannot write to that repository. A fine-grained token needs Contents (and Administration, to make repositories): read and write, for that owner.
A new repository under an organization is refusedThe organization may not allow members to make repositories, or has not approved PopCraft. Make it under your account, or ask an owner.
The push says the branch is protectedPopCraft commits to the default branch. Allow it, or push to a repository without that rule.

Command line and API

popcraft run --ui integration.deploy
curl -X POST -H "Authorization: Bearer $POPCRAFT_TOKEN" https://popcraft.app/api/v1/files/KEY/site/destinations/DESTINATION_ID/deploy

Add a destination, making a new repository named after the site:

curl -X POST -H "Authorization: Bearer $POPCRAFT_TOKEN" -H "content-type: application/json" \
  -d '{"create": true, "capability": "repo", "provider": "github"}' \
  https://popcraft.app/api/v1/files/KEY/site/destinations

The token needs the sites:publish scope. The endpoints are in the reference.