c.Apps.Deploys connects an app to GitHub so a push deploys it. There are two ways to do it: a webhook that you add to the repository, or the Square Cloud GitHub App.
Each snippet below runs on its own inside this program: paste one at a time into main and run goimports (see Running the examples).
Webhook
Deploys.SetWebhook(ctx, appID, accessToken) configures GitHub webhook deploys with a GitHub access token (ghp_... or github_pat_...) and returns the webhook URL to add to your repository.
"@" as the token to remove the webhook. The method then returns "".
INVALID_ACCESS_TOKEN.
GitHub App
Deploys.LinkGithubApp(ctx, appID, repository, branch) links a repository installed through the Square Cloud GitHub App. It needs the apps:deploy scope.
Deploys.UnlinkGithubApp(ctx, appID) removes the link. To link another repository or branch, unlink first.
Current configuration
Deploys.Current(ctx, appID) returns what is configured: App for the GitHub App link, Webhook for the webhook URL. When nothing is set, it returns the zero value (App is nil and Webhook is ""). The fields of App are pointers, since the API may send them as null.
Deploy history
Deploys.List(ctx, appID) returns one timeline per deploy (a [][]DeployEvent), each a slice of events, oldest event first. Only Git deploys (webhook and GitHub App pushes) are recorded.
Next steps
Network
Analytics, DNS, custom domains and cache.
Deploy API reference
The REST endpoints behind these methods.
GitHub deploys from the CLI
The same actions from the terminal.

