github

package
v0.0.0-...-8a4ab9d Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInstallationGitHubClient

func NewInstallationGitHubClient(appID int, privateKey []byte, repoOwner RepositoryOwner) (*ghapi.Client, error)

NewInstallationGitHubClient creates a new client for the installation.

func TrimCommentSentimentAnalysis

func TrimCommentSentimentAnalysis(comment string) (string, error)

TrimCommentSentimentAnalysis removes any sentiment analysis from a comment.

func UpdateCommentWithSentiment

func UpdateCommentWithSentiment(comment string, analysis sa.Analysis) (string, error)

UpdateCommentWithSentiment changes the comment text to include the analyzed sentiment.

Types

type Comment

type Comment struct {
	Body                string      `json:"body"`
	ID                  int64       `json:"id"`
	PullRequestReviewID *int64      `json:"pull_request_review_id,omitempty"`
	CommentUser         CommentUser `json:"user"`
}

Comment is the comment on a GitHub issue from the payload.

type CommentPayload

type CommentPayload struct {
	Action      string       `json:"action"`
	Comment     Comment      `json:"comment"`
	Issue       *Issue       `json:"issue,omitempty"`
	PullRequest *PullRequest `json:"pull_request,omitempty"`
	Repository  Repository   `json:"repository"`
	Sender      Sender       `json:"sender"`
}

CommentPayload represents the payload from GitHub for an issue comment. For more info or to see other fields that might be available, take a look at the webhook events and payloads for:

issue_comment: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#issue_comment
pull_request_review_comment: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request_review_comment

func (CommentPayload) CommentType

func (c CommentPayload) CommentType() (CommentType, error)

CommentType returns the type of comment that it is.

func (CommentPayload) UpdateComment

func (c CommentPayload) UpdateComment(client *ghapi.Client, newComment string) error

UpdateComment updates the comment payload text.

type CommentType

type CommentType int

CommentType allows the ability to distinguish different comment types.

const (
	// CommentTypeIssueComment represents a GitHub issue comment.
	CommentTypeIssueComment CommentType = iota
	// CommentTypePullRequestReviewComment represents a GitHub pull request
	// review comment.
	CommentTypePullRequestReviewComment
	// CommentTypeUnknown is the indication that the comment type is unknown
	// and the output should likely not be trusted.
	CommentTypeUnknown
)

type CommentUser

type CommentUser struct {
	Login string `json:"login"`
}

CommentUser represents the user of the comment.

type Issue

type Issue struct {
	ID  int64  `json:"id"`
	URL string `json:"url"`
}

Issue represents a GitHub issue.

type PullRequest

type PullRequest struct {
	URL string `json:"url"`
}

PullRequest represents a GitHub pull request.

type Repository

type Repository struct {
	FullName string          `json:"full_name"`
	Name     string          `json:"name"`
	Owner    RepositoryOwner `json:"owner"`
}

Repository represents a GitHub repo.

type RepositoryOwner

type RepositoryOwner struct {
	Login string `json:"login"`
}

RepositoryOwner represents the repo owner.

type Sender

type Sender struct {
	Login string `json:"login"`
}

Sender represents the sender of the action from the GitHub API.

Jump to

Keyboard shortcuts

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