Documentation
¶
Overview ¶
Package github reads issues and pull requests from GitHub (or GitHub Enterprise) for the page: an issue as a task card and tab, an issue or a pull request link as a chip. The token stays on the machine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound: no such issue, or the token cannot see it.
ErrUnavailable: GitHub did not answer, or refused (rate limit, bad token).
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct {
Author string `json:"author"`
At *int64 `json:"at"`
Text string `json:"text"`
}
Comment is one comment of an issue.
type Config ¶
type Config struct {
// API is the REST API root: https://api.github.com, or https://<host>/api/v3 for GitHub Enterprise.
API string
// Web is the host of the issue and pull request pages: github.com, or the Enterprise host.
Web string
// Token is a token with read access to the repositories; public repositories work without one (rate limited).
Token string
// Repos are the repositories whose issues the page may show: "owner/repo" or "owner/*"; empty allows any.
Repos []string
// Client calls the API; nil is a client with a 10 s timeout.
Client *http.Client
}
Config names the GitHub the runtime reads.
func FromEnv ¶
FromEnv reads RUNTIME_GITHUB_API, RUNTIME_GITHUB_HOST, RUNTIME_GITHUB_TOKEN and RUNTIME_GITHUB_REPOS.
type IssueMeta ¶
type IssueMeta struct {
Kind string `json:"kind"`
Key string `json:"key"`
Title string `json:"title"`
State *string `json:"state"`
Resolved bool `json:"resolved"`
Assignee *Person `json:"assignee"`
Type *string `json:"type"`
}
IssueMeta is an issue link's chip.
type PullMeta ¶
type PullMeta struct {
Kind string `json:"kind"`
IID int `json:"iid"`
Title string `json:"title"`
State string `json:"state"`
Project string `json:"project"`
Draft bool `json:"draft"`
}
PullMeta is a pull request link's chip, in the page's merge request shape.
type Ref ¶
type Ref struct {
Owner, Repo string
Number int
// Pull is set for a pull request link (an issue key may name either).
Pull bool
}
Ref is one issue or pull request.
type Task ¶
type Task struct {
Key string `json:"key"`
Title string `json:"title"`
Project *string `json:"project"`
Type *string `json:"type"`
State *string `json:"state"`
Priority *string `json:"priority"`
Resolved bool `json:"resolved"`
Assignee *Person `json:"assignee"`
Parent *struct{} `json:"parent"`
Children []struct{} `json:"children"`
Description string `json:"description"`
Comments []Comment `json:"comments"`
Updated *int64 `json:"updated"`
URL string `json:"url"`
Provider string `json:"provider"`
}
Task is an issue in the page's task shape (the same one the YouTrack tracker answers with).