Documentation
¶
Index ¶
- func FormatShadowIssueBody(sourceRepo string, issueNumber int, title, body string) string
- func VerifyWebhookSignature(payload []byte, signature string, secret string) bool
- type Client
- func (c *Client) CloseIssue(ctx context.Context, installationID int64, repo string, issueNumber int) error
- func (c *Client) CreateBranch(ctx context.Context, installationID int64, repo, branchName string) error
- func (c *Client) CreateComment(ctx context.Context, installationID int64, repo string, issueNumber int, ...) (int64, error)
- func (c *Client) CreateIssue(ctx context.Context, installationID int64, repo, title, body string) (int, error)
- func (c *Client) CreateOrUpdateFile(ctx context.Context, installationID int64, repo, path, branch, message string, ...) error
- func (c *Client) CreatePullRequest(ctx context.Context, installationID int64, ...) (int, error)
- func (c *Client) GetFileContents(ctx context.Context, installationID int64, repo, path string) ([]byte, error)
- func (c *Client) GetTree(ctx context.Context, installationID int64, repo, ref string) ([]TreeEntry, error)
- func (c *Client) InstallationToken(ctx context.Context, installationID int64) (string, error)
- func (c *Client) ListComments(ctx context.Context, installationID int64, repo string, issueNumber int) ([]Comment, error)
- func (c *Client) ListInstallations(ctx context.Context) ([]int64, error)
- func (c *Client) SearchIssues(ctx context.Context, installationID int64, query string) ([]IssueSearchResult, error)
- type Comment
- type CommentDetail
- type CommentUser
- type InstallationInfo
- type IssueChangeField
- type IssueChanges
- type IssueCommentEvent
- type IssueDetail
- type IssueEvent
- type IssueSearchResult
- type IssueUser
- type LabelInfo
- type PushCommit
- type PushEvent
- type RepoDetail
- type TreeEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatShadowIssueBody ¶
FormatShadowIssueBody formats an issue body for a shadow repo mirror issue.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the GitHub API for issue operations using GitHub App authentication.
func (*Client) CloseIssue ¶
func (c *Client) CloseIssue(ctx context.Context, installationID int64, repo string, issueNumber int) error
CloseIssue closes a GitHub issue by setting its state to "closed".
func (*Client) CreateBranch ¶
func (c *Client) CreateBranch(ctx context.Context, installationID int64, repo, branchName string) error
CreateBranch creates a new branch from the main branch's HEAD.
func (*Client) CreateComment ¶
func (c *Client) CreateComment(ctx context.Context, installationID int64, repo string, issueNumber int, body string) (int64, error)
CreateComment posts a comment on a GitHub issue and returns the comment ID.
func (*Client) CreateIssue ¶
func (c *Client) CreateIssue(ctx context.Context, installationID int64, repo, title, body string) (int, error)
CreateIssue creates a new issue in a repository and returns the issue number.
func (*Client) CreateOrUpdateFile ¶
func (c *Client) CreateOrUpdateFile(ctx context.Context, installationID int64, repo, path, branch, message string, content []byte) error
CreateOrUpdateFile creates or updates a file in a repository.
func (*Client) CreatePullRequest ¶
func (c *Client) CreatePullRequest(ctx context.Context, installationID int64, repo, title, body, head, base string) (int, error)
CreatePullRequest creates a pull request and returns the PR number.
func (*Client) GetFileContents ¶
func (c *Client) GetFileContents(ctx context.Context, installationID int64, repo, path string) ([]byte, error)
GetFileContents reads a file's contents from a repository via the Contents API. Returns the decoded content bytes and nil error, or nil bytes with nil error if the file does not exist (404).
func (*Client) GetTree ¶
func (c *Client) GetTree(ctx context.Context, installationID int64, repo, ref string) ([]TreeEntry, error)
GetTree fetches the full recursive file tree for a repository at the given ref (branch, tag, or SHA). Only blob entries (files) are returned; tree (directory) entries are filtered out. If the tree response is truncated, a warning is logged to stderr.
func (*Client) InstallationToken ¶
InstallationToken returns an access token for the given installation. This can be used for git clone/push operations via HTTPS.
func (*Client) ListComments ¶
func (c *Client) ListComments(ctx context.Context, installationID int64, repo string, issueNumber int) ([]Comment, error)
ListComments returns all comments on a GitHub issue.
func (*Client) ListInstallations ¶
ListInstallations returns all installation IDs for this GitHub App.
func (*Client) SearchIssues ¶
func (c *Client) SearchIssues(ctx context.Context, installationID int64, query string) ([]IssueSearchResult, error)
SearchIssues searches for issues in a repository using the GitHub search API. The query is passed as the q parameter and URL-encoded internally. Callers should include repo: and is: qualifiers as raw strings.
type Comment ¶
type Comment struct {
ID int64 `json:"id"`
Body string `json:"body"`
User CommentUser `json:"user"`
}
Comment represents a GitHub issue comment.
type CommentDetail ¶
type CommentDetail struct {
ID int64 `json:"id"`
Body string `json:"body"`
User CommentUser `json:"user"`
}
CommentDetail is the comment portion of an issue_comment event.
type CommentUser ¶
CommentUser represents the user who made a comment.
type InstallationInfo ¶
type InstallationInfo struct {
ID int64 `json:"id"`
}
InstallationInfo identifies the GitHub App installation that sent the event.
type IssueChangeField ¶
type IssueChangeField struct {
From string `json:"from"`
}
IssueChangeField holds the previous value of a changed field.
type IssueChanges ¶
type IssueChanges struct {
Body *IssueChangeField `json:"body,omitempty"`
}
IssueChanges represents the changes payload sent by GitHub on issues.edited events.
type IssueCommentEvent ¶
type IssueCommentEvent struct {
Action string `json:"action"`
Issue IssueDetail `json:"issue"`
Comment CommentDetail `json:"comment"`
Repo RepoDetail `json:"repository"`
Installation InstallationInfo `json:"installation"`
}
IssueCommentEvent represents a GitHub issue_comment webhook event payload.
type IssueDetail ¶
type IssueDetail struct {
Number int `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
State string `json:"state"`
Labels []LabelInfo `json:"labels"`
User IssueUser `json:"user"`
}
IssueDetail is the issue portion of a webhook event.
type IssueEvent ¶
type IssueEvent struct {
Action string `json:"action"`
Issue IssueDetail `json:"issue"`
Changes *IssueChanges `json:"changes,omitempty"`
Repo RepoDetail `json:"repository"`
Installation InstallationInfo `json:"installation"`
}
IssueEvent represents a GitHub issue webhook event payload.
type IssueSearchResult ¶
type IssueSearchResult struct {
Number int `json:"number"`
Title string `json:"title"`
State string `json:"state"`
}
IssueSearchResult represents a single issue returned from the GitHub search API.
type IssueUser ¶
type IssueUser struct {
Login string `json:"login"`
}
IssueUser is the user who created the issue.
type PushCommit ¶
type PushCommit struct {
Added []string `json:"added"`
Modified []string `json:"modified"`
Removed []string `json:"removed"`
}
PushCommit represents a single commit in a push event.
type PushEvent ¶
type PushEvent struct {
Ref string `json:"ref"`
Commits []PushCommit `json:"commits"`
Repo RepoDetail `json:"repository"`
Installation InstallationInfo `json:"installation"`
}
PushEvent represents a GitHub push webhook event payload.
type RepoDetail ¶
type RepoDetail struct {
FullName string `json:"full_name"`
}
RepoDetail is the repository portion of a webhook event.