{"modulePath":"github.com/taskcluster/taskcluster-client-go","version":"v0.0.0-20190911123152-a5b7ecb3c6a6","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package tcgithub\n\nThe github service is responsible for creating tasks in reposnse to GitHub events, and posting results to the GitHub UI.\n\nThis document describes the API end-point for consuming GitHub web hooks, as well as some useful consumer APIs.\n\nWhen Github forbids an action, this service returns an HTTP 403 with code ForbiddenByGithub.\n\nSee:\n\n### How to use this package {#hdr-How_to_use_this_package}\n\nFirst create a Github object:\n\n\tgithub := tcgithub.New(nil)\n\nand then call one or more of github's methods, e.g.:\n\n\terr := github.Ping(.....)\n\nhandling any errors...\n\n\tif err != nil {\n\t\t// handle error...\n\t}\n\n### Taskcluster Schema {#hdr-Taskcluster_Schema}\n\nThe source code of this go package was auto-generated from the API definition at [https://taskcluster-staging.net/references/github/v1/api.json](https://taskcluster-staging.net/references/github/v1/api.json) together with the input and output schemas it references, downloaded on Thu, 27 Jun 2019 at 07:22:00 UTC. The code was generated by [https://github.com/taskcluster/taskcluster-client-go/blob/master/build.sh](https://github.com/taskcluster/taskcluster-client-go/blob/master/build.sh).\n\n## Types\n\n```go\ntype Build struct {\n\n\t// The initial creation time of the build. This is when it became pending.\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/created\n\tCreated tcclient.Time `json:\"created\"`\n\n\t// The GitHub webhook deliveryId. Extracted from the header 'X-GitHub-Delivery'\n\t//\n\t// One of:\n\t//   * GithubGUID\n\t//   * UnknownGithubGUID\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/eventId\n\tEventID string `json:\"eventId\"`\n\n\t// Type of Github event that triggered the build (i.e. push, pull_request.opened).\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/eventType\n\tEventType string `json:\"eventType\"`\n\n\t// Github organization associated with the build.\n\t//\n\t// Syntax:     ^([a-zA-Z0-9-_%]*)$\n\t// Min length: 1\n\t// Max length: 100\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/organization\n\tOrganization string `json:\"organization\"`\n\n\t// Github repository associated with the build.\n\t//\n\t// Syntax:     ^([a-zA-Z0-9-_%]*)$\n\t// Min length: 1\n\t// Max length: 100\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/repository\n\tRepository string `json:\"repository\"`\n\n\t// Github revision associated with the build.\n\t//\n\t// Min length: 40\n\t// Max length: 40\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/sha\n\tSha string `json:\"sha\"`\n\n\t// Github status associated with the build.\n\t//\n\t// Possible values:\n\t//   * \"pending\"\n\t//   * \"success\"\n\t//   * \"error\"\n\t//   * \"failure\"\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/state\n\tState string `json:\"state\"`\n\n\t// Taskcluster task-group associated with the build.\n\t//\n\t// Syntax:     ^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/taskGroupId\n\tTaskGroupID string `json:\"taskGroupId\"`\n\n\t// The last updated of the build. If it is done, this is when it finished.\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/updated\n\tUpdated tcclient.Time `json:\"updated\"`\n}\n```\nSee [https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items](https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items)\n\n```go\ntype BuildsResponse struct {\n\n\t// A simple list of builds.\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds\n\tBuilds []Build `json:\"builds\"`\n\n\t// Passed back from Azure to allow us to page through long result sets.\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/continuationToken\n\tContinuationToken string `json:\"continuationToken,omitempty\"`\n}\n```\nA paginated list of builds\n\nSee [https://taskcluster-staging.net/schemas/github/v1/build-list.json#](https://taskcluster-staging.net/schemas/github/v1/build-list.json#)\n\n```go\ntype CreateCommentRequest struct {\n\n\t// The contents of the comment.\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/create-comment.json#/properties/body\n\tBody string `json:\"body\"`\n}\n```\nWrite a new comment on a GitHub Issue or Pull Request. Full specification on \\[GitHub docs]([https://developer.github.com/v3/issues/comments/#create-a-comment](https://developer.github.com/v3/issues/comments/#create-a-comment))\n\nSee [https://taskcluster-staging.net/schemas/github/v1/create-comment.json#](https://taskcluster-staging.net/schemas/github/v1/create-comment.json#)\n\n```go\ntype CreateStatusRequest struct {\n\n\t// A string label to differentiate this status from the status of other systems.\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/create-status.json#/properties/context\n\tContext string `json:\"context,omitempty\"`\n\n\t// A short description of the status.\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/create-status.json#/properties/description\n\tDescription string `json:\"description,omitempty\"`\n\n\t// The state of the status.\n\t//\n\t// Possible values:\n\t//   * \"pending\"\n\t//   * \"success\"\n\t//   * \"error\"\n\t//   * \"failure\"\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/create-status.json#/properties/state\n\tState string `json:\"state\"`\n\n\t// The target URL to associate with this status. This URL will be linked from the GitHub UI to allow users to easily see the 'source' of the Status.\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/create-status.json#/properties/target_url\n\tTarget_URL string `json:\"target_url,omitempty\"`\n}\n```\nCreate a commit status on GitHub. Full specification on \\[GitHub docs]([https://developer.github.com/v3/repos/statuses/#create-a-status](https://developer.github.com/v3/repos/statuses/#create-a-status))\n\nSee [https://taskcluster-staging.net/schemas/github/v1/create-status.json#](https://taskcluster-staging.net/schemas/github/v1/create-status.json#)\n\n```go\ntype Github tcclient.Client\n```\n\n```go\nfunc New(credentials *tcclient.Credentials, rootURL string) *Github\n```\nNew returns a Github client, configured to run against production. Pass in nil credentials to create a client without authentication. The returned client is mutable, so returned settings can be altered.\n\n\tgithub := tcgithub.New(\n\t    nil,                                      // client without authentication\n\t    \"http://localhost:1234/my/taskcluster\",   // taskcluster hosted at this root URL on local machine\n\t)\n\terr := github.Ping(.....)                     // for example, call the Ping(.....) API endpoint (described further down)...\n\tif err != nil {\n\t\t// handle errors...\n\t}\n\n```go\nfunc NewFromEnv() *Github\n```\nNewFromEnv returns a \\*Github configured from environment variables.\n\nThe root URL is taken from TASKCLUSTER\\_PROXY\\_URL if set to a non-empty string, otherwise from TASKCLUSTER\\_ROOT\\_URL if set, otherwise the empty string.\n\nThe credentials are taken from environment variables:\n\n\tTASKCLUSTER_CLIENT_ID\n\tTASKCLUSTER_ACCESS_TOKEN\n\tTASKCLUSTER_CERTIFICATE\n\nIf TASKCLUSTER\\_CLIENT\\_ID is empty/unset, authentication will be disabled.\n\n```go\nfunc (github *Github) Badge(owner, repo, branch string) error\n```\nStability: \\*\\*\\* EXPERIMENTAL \\*\\*\\*\n\nChecks the status of the latest build of a given branch and returns corresponding badge svg.\n\nSee #badge\n\n```go\nfunc (github *Github) Builds(continuationToken, limit, organization, repository, sha string) (*BuildsResponse, error)\n```\nStability: \\*\\*\\* EXPERIMENTAL \\*\\*\\*\n\nA paginated list of builds that have been run in Taskcluster. Can be filtered on various git-specific fields.\n\nSee #builds\n\n```go\nfunc (github *Github) CreateComment(owner, repo, number string, payload *CreateCommentRequest) error\n```\nStability: \\*\\*\\* EXPERIMENTAL \\*\\*\\*\n\nFor a given Issue or Pull Request of a repository, this will write a new message.\n\nRequired scopes:\n\n\tgithub:create-comment:\u003cowner\u003e/\u003crepo\u003e\n\nSee #createComment\n\n```go\nfunc (github *Github) CreateStatus(owner, repo, sha string, payload *CreateStatusRequest) error\n```\nStability: \\*\\*\\* EXPERIMENTAL \\*\\*\\*\n\nFor a given changeset (SHA) of a repository, this will attach a \"commit status\" on github. These statuses are links displayed next to each revision. The status is either OK (green check) or FAILURE (red cross), made of a custom title and link.\n\nRequired scopes:\n\n\tgithub:create-status:\u003cowner\u003e/\u003crepo\u003e\n\nSee #createStatus\n\n```go\nfunc (github *Github) GithubWebHookConsumer() error\n```\nStability: \\*\\*\\* EXPERIMENTAL \\*\\*\\*\n\nCapture a GitHub event and publish it via pulse, if it's a push, release or pull request.\n\nSee #githubWebHookConsumer\n\n```go\nfunc (github *Github) Latest(owner, repo, branch string) error\n```\nStability: \\*\\*\\* EXPERIMENTAL \\*\\*\\*\n\nFor a given branch of a repository, this will always point to a status page for the most recent task triggered by that branch.\n\nNote: This is a redirect rather than a direct link.\n\nSee #latest\n\n```go\nfunc (github *Github) Ping() error\n```\nRespond without doing anything. This endpoint is used to check that the service is up.\n\nSee #ping\n\n```go\nfunc (github *Github) Repository(owner, repo string) (*RepositoryResponse, error)\n```\nStability: \\*\\*\\* EXPERIMENTAL \\*\\*\\*\n\nReturns any repository metadata that is useful within Taskcluster related services.\n\nSee #repository\n\n```go\ntype GithubGUID string\n```\nThe GitHub webhook deliveryId. Extracted from the header 'X-GitHub-Delivery'\n\nSyntax:     ^\\[a-zA-Z0-9]{8}-\\[a-zA-Z0-9]{4}-\\[a-zA-Z0-9]{4}-\\[a-zA-Z0-9]{4}-\\[a-zA-Z0-9]{12}$\n\nSee [https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/eventId/oneOf\\[0]](https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/eventId/oneOf[0])\n\n```go\ntype RepositoryResponse struct {\n\n\t// True if integration is installed, False otherwise.\n\t//\n\t// See https://taskcluster-staging.net/schemas/github/v1/repository.json#/properties/installed\n\tInstalled bool `json:\"installed\"`\n}\n```\nAny Taskcluster-specific Github repository information.\n\nSee [https://taskcluster-staging.net/schemas/github/v1/repository.json#](https://taskcluster-staging.net/schemas/github/v1/repository.json#)\n\n```go\ntype UnknownGithubGUID string\n```\nThe GitHub webhook deliveryId. Extracted from the header 'X-GitHub-Delivery'\n\nPossible values:\n\n  - \"Unknown\"\n\nSee [https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/eventId/oneOf\\[1]](https://taskcluster-staging.net/schemas/github/v1/build-list.json#/properties/builds/items/properties/eventId/oneOf[1])\n\n","path":"github.com/taskcluster/taskcluster-client-go/tcgithub","name":"tcgithub","synopsis":"The github service is responsible for creating tasks in reposnse to GitHub events, and posting results to the GitHub UI.","isRedistributable":true}
