Documentation ¶
Index ¶
- func Execute(tpl *template.Template, ctx *Context, ctxfn *ContextFuncs) (string, error)
- func FilterComments(comments []*github.IssueComment, authorName string, typeName string) (int64, bool)
- func GetComments(ctx context.Context, client *github.Client, owner string, repo string, ...) ([]*github.IssueComment, error)
- func GetIssue(ctx context.Context, client *github.Client, owner string, repo string, ...) (*github.Issue, error)
- func GetSelf(ctx context.Context, client *github.Client) (*github.User, error)
- func NewClient(ctx context.Context, token string) *github.Client
- func PostComment(ctx context.Context, client *github.Client, owner string, repo string, ...) (string, error)
- func Report(comment, url, user, login, owner, repo string, number int, updated bool, ...)
- func SplitPullRequestReference(reference string) (string, string, int, bool)
- func UpdateComment(ctx context.Context, client *github.Client, owner string, repo string, ...) (string, error)
- type Context
- type ContextFuncs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
Execute applies the given context to the given template and returns the result as a string.
func FilterComments ¶
func FilterComments(comments []*github.IssueComment, authorName string, typeName string) (int64, bool)
FilterComments selects the most recently updated comment, that was authored by the current user, if any exist.
func GetComments ¶
func GetComments(ctx context.Context, client *github.Client, owner string, repo string, number int) ([]*github.IssueComment, error)
GetComments fetches all comments for the given pull request number.
func GetIssue ¶
func GetIssue(ctx context.Context, client *github.Client, owner string, repo string, number int) (*github.Issue, error)
GetIssue fetches information about the current pull request.
func PostComment ¶
func PostComment(ctx context.Context, client *github.Client, owner string, repo string, number int, comment string) (string, error)
PostComment creates a new comment on the given PR.
func Report ¶
Report display a textual report about the pull request, and comment that was just posted.
func SplitPullRequestReference ¶
splitPullRequestReference splits a pull request reference string into the owner, repo, and number of the PR.
References should look like "https://github.com/joshdk/hub-comment/pull/123" or "joshdk/hub-comment#123".
Types ¶
type Context ¶
type Context struct { // Build is a map of CircleCI specific parameters. Build map[string]string // Env is a map of available environment variables. Env map[string]string // Git is a map of GitHub specific parameters. Git map[string]string // Labels is a list of all labels used in the current PR. Labels []string // Meta is a map of parameters specific to the internal operation of // hub-comment. Meta map[string]string // Pull is a map of parameters specific to the current PR. Pull map[string]string }
Context represents a logical grouping of data for use with comment templates.
type ContextFuncs ¶
type ContextFuncs struct { // Context is the Context for running functions against. Context *Context }
ContextFuncs represents a logical grouping of text/template functions that need access to the current Context.
func NewTemplate ¶
func NewTemplate(body []byte) (*template.Template, *ContextFuncs, error)
NewTemplate is a helper for constructing a template object.
func (*ContextFuncs) Label ¶
func (ctx *ContextFuncs) Label(name string) bool
Label returns true if the underlying Context contains the named label.