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
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.
- Publish the site. A destination is sent a published version.
- 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.
- 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 commit | One commit on the default branch, on top of what is there. Its message names the version. |
| The files | The same static site PopCraft hosts: a page of HTML per screen, site.json, the pc/ scripts, assets/. |
| Your other files | Left alone. A README, a workflow, a CNAME: anything PopCraft did not write stays. |
| Files from an earlier push | Replaced, and removed when the site no longer has them. PopCraft keeps the list in .popcraft/files.json. |
| An empty repository | Gets 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.
| Tool | What it does |
|---|---|
list_integration_resources | The owners, then the repositories, of a connected account. |
add_site_destination | Choose a repository, or make one (create: true, or createNamed under an owner). Asks first. |
deploy_site | Push 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 see | What to do |
|---|---|
| Resource not accessible by integration or 403 | The 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 refused | The 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 protected | PopCraft commits to the default branch. Allow it, or push to a repository without that rule. |
Command line and API
popcraft run --ui integration.deploycurl -X POST -H "Authorization: Bearer $POPCRAFT_TOKEN" https://popcraft.app/api/v1/files/KEY/site/destinations/DESTINATION_ID/deployAdd 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/destinationsThe token needs the sites:publish scope. The endpoints are in the reference.