Documentation
¶
Index ¶
- Constants
- func ResolveOwnerName(owner *gogithub.User) (string, error)
- func String(str string) *string
- type Client
- func (c *Client) AddMergeRequestDiscussionReply(ctx context.Context, prID int, fullName, discussionID, comment string) (vcs.MRNote, error)
- func (c *Client) CloneMergeRequest(ctx context.Context, project string, mr vcs.MR, dest string) (vcs.GitRepo, error)
- func (c *Client) CreateMergeRequestComment(ctx context.Context, prID int, fullName string, comment string) error
- func (c *Client) CreateMergeRequestCommentWithID(ctx context.Context, prID int, fullName, comment string) (int64, error)
- func (c *Client) CreateMergeRequestDiscussion(ctx context.Context, prID int, fullName string, comment string) (vcs.MRDiscussionNotes, error)
- func (c *Client) GetAuthenticatedAccountName(ctx context.Context) (string, error)
- func (c *Client) GetCommitJobStatuses(ctx context.Context, projectWithNS string, commitSHA string) ([]vcs.CommitJobStatus, error)
- func (c *Client) GetIssue(ctx context.Context, owner *gogithub.User, repo string, issueId int) (*gogithub.Issue, error)
- func (c *Client) GetMergeRequest(ctx context.Context, prID int, fullName string) (vcs.DetailedMR, error)
- func (c *Client) GetMergeRequestApprovals(ctx context.Context, id int, project string) (vcs.MRApproved, error)
- func (c *Client) GetMergeRequestModifiedFiles(ctx context.Context, prID int, fullName string) ([]string, error)
- func (c *Client) GetOldRunUrls(ctx context.Context, prID int, fullName string, rootCommentID int, ...) (string, error)
- func (c *Client) GetPipelinesForCommit(ctx context.Context, projectWithNS string, commitSHA string) ([]vcs.ProjectPipeline, error)
- func (c *Client) GetProjectSettings(ctx context.Context, projectWithNS string) (vcs.ProjectSettings, error)
- func (c *Client) GetPullRequest(ctx context.Context, fullName string, prID int) (*GithubPR, error)
- func (c *Client) GetRepoFile(ctx context.Context, fullName string, file string, ref string) ([]byte, error)
- func (c *Client) ListRepoDirectories(ctx context.Context, fullName, dir, ref string) ([]string, error)
- func (c *Client) MergeMR(ctx context.Context, mrIID int, project string) error
- func (c *Client) MergeMRAtSHA(ctx context.Context, mrIID int, project, _ string) error
- func (c *Client) PostIssueComment(ctx context.Context, prId int, fullName string, body string) (*gogithub.IssueComment, error)
- func (c *Client) PostPullRequestComment(ctx context.Context, owner, repo string, prId int, body string) error
- func (c *Client) PostRunResult(ctx context.Context, prID int, fullName string, rootCommentID int, body string) error
- func (c *Client) ResolveMergeRequestDiscussion(ctx context.Context, s string, i int, s2 string) error
- func (c *Client) ResolveMergeRequestDiscussions(context.Context, string, int, string, string) error
- func (c *Client) SetCommitStatus(ctx context.Context, projectWithNS string, commitSHA string, ...) (vcs.CommitStatus, error)
- func (c *Client) SetWorkspaceStatus(ctx context.Context, status vcs.WorkspaceStatus) error
- func (c *Client) SupportsAggregateAutoMerge() bool
- func (c *Client) UpdateMergeRequestComment(ctx context.Context, _ int, noteID int64, fullName, comment string) error
- func (c *Client) UpdateMergeRequestDiscussionNote(ctx context.Context, mrIID, noteID int, project, discussionID, comment string) (vcs.MRNote, error)
- type GithubPR
- func (gm *GithubPR) GetAuthor() vcs.MRAuthor
- func (gm *GithubPR) GetInternalID() int
- func (gm *GithubPR) GetSourceBranch() string
- func (gm *GithubPR) GetState() string
- func (gm *GithubPR) GetTargetBranch() string
- func (gm *GithubPR) GetTitle() string
- func (gm *GithubPR) GetWebURL() string
- func (gm *GithubPR) HasConflicts() bool
- func (gm *GithubPR) IsApproved() bool
- func (gm *GithubPR) IsDraft() bool
- type GithubPRAuthor
- type GithubPRIssueComment
- type IssueComment
- type PRApproved
- type RunEventsWorker
Constants ¶
const DefaultMaxRetries = 3
const GITHUB_CLONE_DEPTH_ENV = "TFBUDDY_GITHUB_CLONE_DEPTH"
Variables ¶
This section is empty.
Functions ¶
func ResolveOwnerName ¶
ResolveOwnerName is a helper func to find a name for the repo owner, which could be in the `Name` field or `Login.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewGithubClient ¶
func (*Client) AddMergeRequestDiscussionReply ¶
func (*Client) CloneMergeRequest ¶
func (*Client) CreateMergeRequestComment ¶
func (*Client) CreateMergeRequestCommentWithID ¶ added in v0.7.1
func (*Client) CreateMergeRequestDiscussion ¶
func (*Client) GetAuthenticatedAccountName ¶ added in v0.7.1
func (*Client) GetCommitJobStatuses ¶ added in v0.6.0
func (*Client) GetMergeRequest ¶
func (*Client) GetMergeRequestApprovals ¶
func (*Client) GetMergeRequestModifiedFiles ¶
func (*Client) GetOldRunUrls ¶ added in v0.2.0
func (c *Client) GetOldRunUrls(ctx context.Context, prID int, fullName string, rootCommentID int, runID string, workspace string, action string) (string, error)
GetOldRunUrls crawls PR comments authored by the bot, collects previous TFC run URLs into a collapsible block, and (when TFBUDDY_DELETE_OLD_COMMENTS is set) deletes old comments that belong to the same workspace+action combination. Comments for other workspaces or actions are left untouched.
GitHub has no threads: the run's starting comment (rootCommentID) and each of its status updates are separate comments. Old comments are those posted before the starting comment, and the run's own status updates, found by runID. The starting comment itself is kept until a newer run cleans up.
Two runs of one workspace can overlap, for example a push and a `tfc plan` comment in the same minute. A comment posted after the starting comment by another run is left alone: it belongs to a newer run, or to an older run that is still posting. When a newer run has already deleted this run's starting comment, the run is superseded: it only deletes its own status updates and returns vcs.ErrRunSuperseded, so it does not post a stale result after the newer one. PostRunResult covers a newer run that replaces this one after this check.
func (*Client) GetPipelinesForCommit ¶
func (*Client) GetProjectSettings ¶ added in v0.6.0
func (*Client) GetPullRequest ¶
func (*Client) GetRepoFile ¶
func (*Client) ListRepoDirectories ¶ added in v0.8.3
func (c *Client) ListRepoDirectories(ctx context.Context, fullName, dir, ref string) ([]string, error)
ListRepoDirectories returns every directory below dir at ref, recursively, relative to the repo root. A dir that does not exist at ref yields nothing.
func (*Client) MergeMRAtSHA ¶ added in v0.7.0
MergeMRAtSHA satisfies the shared VCS interface. GitHub auto-merge does not use the GitLab-only aggregate coordinator, so preserve its existing behavior.
func (*Client) PostIssueComment ¶
func (c *Client) PostIssueComment(ctx context.Context, prId int, fullName string, body string) (*gogithub.IssueComment, error)
PostIssueComment adds a comment to an existing Pull Request
func (*Client) PostPullRequestComment ¶
func (c *Client) PostPullRequestComment(ctx context.Context, owner, repo string, prId int, body string) error
PostPullRequestComment adds a review comment to an existing PullRequest
func (*Client) PostRunResult ¶ added in v0.8.6
func (c *Client) PostRunResult(ctx context.Context, prID int, fullName string, rootCommentID int, body string) error
PostRunResult posts a run's final comment. GetOldRunUrls only checks that the run is current before the result is posted: a newer run of the same workspace, handled on another replica, can delete this run's starting comment (rootCommentID) and post its own result in between. So once the result is posted, the starting comment is checked again. If it is gone, the result is stale and is deleted again, keeping the newer run's result last, and vcs.ErrRunSuperseded is returned.
func (*Client) ResolveMergeRequestDiscussion ¶
func (*Client) ResolveMergeRequestDiscussions ¶ added in v0.7.0
func (*Client) SetCommitStatus ¶
func (c *Client) SetCommitStatus(ctx context.Context, projectWithNS string, commitSHA string, status vcs.CommitStatusOptions) (vcs.CommitStatus, error)
func (*Client) SetWorkspaceStatus ¶ added in v0.8.0
SetWorkspaceStatus is intentionally a no-op. GitHub commit statuses are not implemented (see SetCommitStatus above), so TFBuddy surfaces skipped and failed workspaces on GitHub through pull request comments instead.
func (*Client) SupportsAggregateAutoMerge ¶ added in v0.7.0
func (*Client) UpdateMergeRequestComment ¶ added in v0.7.1
type GithubPR ¶
type GithubPR struct {
*gogithub.PullRequest
}
func (*GithubPR) GetInternalID ¶
func (*GithubPR) GetSourceBranch ¶
func (*GithubPR) GetTargetBranch ¶
func (*GithubPR) HasConflicts ¶
func (*GithubPR) IsApproved ¶
type GithubPRAuthor ¶
func (*GithubPRAuthor) GetUsername ¶
func (ga *GithubPRAuthor) GetUsername() string
type GithubPRIssueComment ¶
type GithubPRIssueComment struct {
*gogithub.IssueComment
}
func (*GithubPRIssueComment) GetDiscussionID ¶
func (c *GithubPRIssueComment) GetDiscussionID() string
func (*GithubPRIssueComment) GetMRNotes ¶
func (c *GithubPRIssueComment) GetMRNotes() []vcs.MRNote
type IssueComment ¶
type IssueComment struct {
*gogithub.IssueComment
}
func (*IssueComment) GetDiscussionID ¶
func (c *IssueComment) GetDiscussionID() string
func (*IssueComment) GetMRNotes ¶
func (c *IssueComment) GetMRNotes() []vcs.MRNote
func (*IssueComment) GetNoteID ¶
func (c *IssueComment) GetNoteID() int64
type PRApproved ¶
type PRApproved struct {
// contains filtered or unexported fields
}
func (*PRApproved) IsApproved ¶
func (p *PRApproved) IsApproved() bool
type RunEventsWorker ¶
type RunEventsWorker struct {
// contains filtered or unexported fields
}
func NewRunEventsWorker ¶
func NewRunEventsWorker(cfg config.Config, client *Client, rs runstream.StreamClient, tfc tfc_api.ApiClient) *RunEventsWorker
func (*RunEventsWorker) Close ¶
func (w *RunEventsWorker) Close()