githubcomment

package module
v0.0.0-...-d66cad1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2019 License: MIT Imports: 9 Imported by: 1

README

github-comment

Create or update an github comment

Usage:

# Create a new comment in the pull request owner/repo/pulls/2 wth the unique id 123-ABC
github-comment --repo owner/repo --pr 2 --id "123-ABC" "Hello World"

# Update the comment
github-comment --repo owner/repo --pr 2 --id "123-ABC" "Hello Universe"

# Update the comment another time
echo "Hello there!" |  github-comment --repo owner/repo --pr 2 --id "123-ABC"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GithubComment

type GithubComment struct {
	Client     *github.Client
	Context    context.Context
	Owner      string
	Repository string
}

func (*GithubComment) FindIssueComment

func (gc *GithubComment) FindIssueComment(issueID int, id ID) (*github.Issue, *github.IssueComment, error)

FindIssueComment finds a issue comment and returns it

func (*GithubComment) GetIssueComment

func (gc *GithubComment) GetIssueComment(issueID int, id ID) (*Info, error)

GetIssueComment returns the info for a comment

func (*GithubComment) PostIssueComment

func (gc *GithubComment) PostIssueComment(issueID int, id ID, text string, meta interface{}) error

PostIssueComment posts a new comment with the specified id

func (*GithubComment) PostOrUpdateIssueComment

func (gc *GithubComment) PostOrUpdateIssueComment(issueID int, id ID, text string, meta interface{}) error

PostOrUpdateIssueComment posts an new comment if it was not able to update the existing comment, if you omit the ID it will always post a new comment

func (*GithubComment) UpdateIssueComment

func (gc *GithubComment) UpdateIssueComment(issueID int, id ID, text string, meta interface{}) error

UpdateIssueComment updates an existing comment

type ID

type ID string

func (ID) GetID

func (i ID) GetID() string

type IDMustBeSpecifiedError

type IDMustBeSpecifiedError struct{}

func (IDMustBeSpecifiedError) Error

func (e IDMustBeSpecifiedError) Error() string

type Info

type Info struct {
	ID   ID
	Body string
	Meta interface{}
}

func ParseInfo

func ParseInfo(raw string) (*Info, error)

ParseInfo parses the body of a comment

func (*Info) Build

func (i *Info) Build() (string, error)

Build builds a info

type IssueCommentNotFoundError

type IssueCommentNotFoundError struct {
	ID ID
}

func (IssueCommentNotFoundError) Error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL