Deploy a Worker from GitHub
const url = 'https://digize.com/api/v1/sites/example/source';const options = { method: 'PUT', headers: { 'Idempotency-Key': '5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69', 'x-api-key': '<x-api-key>', 'Content-Type': 'application/json' }, body: '{"repo":"example","branch":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://digize.com/api/v1/sites/example/source \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: 5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69' \ --header 'x-api-key: <x-api-key>' \ --data '{ "repo": "example", "branch": "example" }'Links a Worker to a repository on GitHub the workspace’s installation reaches, and builds the branch’s head there now. From then on each push to that branch on GitHub is mirrored into the Worker’s repo and built; pushes to the Worker’s own repo on that branch aren’t. The Worker’s branch setting becomes branch, or the repository’s default branch.
Needs the sites:write permission.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Makes the request safe to send again: for 24 hours the same key and request answer the first response without repeating the change.
Example
5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69Request Bodyrequired
Section titled “Request Bodyrequired”object
The repository as GitHub names it: owner/name.
The branch to deploy. Left out, the repository’s default branch.
Example generated
{ "repo": "example", "branch": "example"}Responses
Section titled “Responses”Done
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Example
{ "worker": { "kind": "site", "source": { "provider": "github" }, "status": "live", "lastDeployment": { "status": "queued" }, "settings": { "placement": "default" }, "bindings": [ { "type": "d1" } ], "domains": [ { "kind": "custom", "setup": "full", "status": "active", "certificate": "active", "records": [ { "type": "CNAME", "status": "found" } ] } ], "recentDeployments": [ { "status": "queued", "kind": "push", "failedStage": "build" } ] }, "deployment": { "status": "queued", "kind": "push", "failedStage": "build" }}What was sent isn’t valid (invalid).
object
object
object
Example
{ "error": { "code": "invalid" }}No key, or one that’s unknown, off or expired.
object
object
object
Example
{ "error": { "code": "invalid" }}The key doesn’t have the permission this needs.
object
object
object
Example
{ "error": { "code": "invalid" }}Nothing has that id (not_found).
object
object
object
Example
{ "error": { "code": "invalid" }}A request with the same Idempotency-Key is still running (conflict).
object
object
object
Example
{ "error": { "code": "invalid" }}The Idempotency-Key was used with a different request.
object
object
object
Example
{ "error": { "code": "invalid" }}Over the rate limit; see retry-after.
object
object
object
Example
{ "error": { "code": "invalid" }}