Documentation
¶
Overview ¶
Package checks provides integrations for creating check runs on CI platforms.
Index ¶
- Constants
- type CheckRunOutput
- type CheckRunRequest
- type CheckRunResponse
- type CommentOptions
- type CommentResponse
- type CreateCheckOptions
- type GitHubClient
- func (c *GitHubClient) CreateCheck(ctx context.Context, report *confidence.Report, opts CreateCheckOptions) (*CheckRunResponse, error)
- func (c *GitHubClient) DeleteComment(ctx context.Context, opts CommentOptions, commentID int64) error
- func (c *GitHubClient) FindAllConfvisComments(ctx context.Context, opts CommentOptions) ([]CommentResponse, error)
- func (c *GitHubClient) FindComment(ctx context.Context, opts CommentOptions) (*CommentResponse, error)
- func (c *GitHubClient) PostComment(ctx context.Context, opts CommentOptions, body string) (*CommentResponse, error)
- func (c *GitHubClient) UpdateComment(ctx context.Context, opts CommentOptions, commentID int64, body string) (*CommentResponse, error)
- type GitHubClientConfig
- type GitHubEnv
Constants ¶
const CommentMarker = "<!-- confvis-comment -->"
CommentMarker is the hidden HTML comment used to identify confvis comments. Known limitation: if a user edits a confvis PR comment and removes this marker, confvis will create a duplicate comment on the next run rather than updating the existing one. This is by design — reliable identification without external state requires the marker to be present in the comment body.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckRunOutput ¶
type CheckRunOutput struct {
Title string `json:"title"`
Summary string `json:"summary"`
Text string `json:"text,omitempty"`
}
CheckRunOutput represents the output section of a check run.
type CheckRunRequest ¶
type CheckRunRequest struct {
Name string `json:"name"`
HeadSHA string `json:"head_sha"`
Status string `json:"status"`
Conclusion string `json:"conclusion,omitempty"`
Output *CheckRunOutput `json:"output,omitempty"`
}
CheckRunRequest is the request body for creating a check run.
type CheckRunResponse ¶
type CheckRunResponse struct {
ID int64 `json:"id"`
HTMLURL string `json:"html_url"`
Status string `json:"status"`
}
CheckRunResponse is the response from creating a check run.
type CommentOptions ¶ added in v1.0.0
type CommentOptions struct {
Owner string // Repository owner
Repo string // Repository name
PR int // Pull request number
}
CommentOptions configures comment posting.
type CommentResponse ¶ added in v1.0.0
type CommentResponse struct {
ID int64 `json:"id"`
HTMLURL string `json:"html_url"`
Body string `json:"body"`
}
CommentResponse is the response from creating/updating a comment.
type CreateCheckOptions ¶
type CreateCheckOptions struct {
Owner string // Repository owner
Repo string // Repository name
SHA string // Commit SHA
Name string // Check name
BaseURL string // Optional: Override base URL for compare baseline
}
CreateCheckOptions configures the check run creation.
type GitHubClient ¶
type GitHubClient struct {
// contains filtered or unexported fields
}
GitHubClient is an HTTP client for the GitHub Checks API.
func NewGitHubClient ¶
func NewGitHubClient(cfg GitHubClientConfig) *GitHubClient
NewGitHubClient creates a new GitHub Checks API client.
func NewGitHubClientWithHTTP ¶
func NewGitHubClientWithHTTP(cfg GitHubClientConfig, httpClient *http.Client) *GitHubClient
NewGitHubClientWithHTTP creates a new client with a custom HTTP client. This is primarily intended for testing.
func (*GitHubClient) CreateCheck ¶
func (c *GitHubClient) CreateCheck(ctx context.Context, report *confidence.Report, opts CreateCheckOptions) (*CheckRunResponse, error)
CreateCheck creates a check run for the given confidence report.
func (*GitHubClient) DeleteComment ¶ added in v1.0.0
func (c *GitHubClient) DeleteComment(ctx context.Context, opts CommentOptions, commentID int64) error
DeleteComment deletes a comment.
func (*GitHubClient) FindAllConfvisComments ¶ added in v1.0.0
func (c *GitHubClient) FindAllConfvisComments(ctx context.Context, opts CommentOptions) ([]CommentResponse, error)
FindAllConfvisComments finds all confvis comments on a PR. Returns empty slice if no confvis comments are found.
func (*GitHubClient) FindComment ¶ added in v1.0.0
func (c *GitHubClient) FindComment(ctx context.Context, opts CommentOptions) (*CommentResponse, error)
FindComment finds an existing confvis comment on a PR. Returns nil if no confvis comment is found.
func (*GitHubClient) PostComment ¶ added in v1.0.0
func (c *GitHubClient) PostComment(ctx context.Context, opts CommentOptions, body string) (*CommentResponse, error)
PostComment creates a new comment on a PR.
func (*GitHubClient) UpdateComment ¶ added in v1.0.0
func (c *GitHubClient) UpdateComment(ctx context.Context, opts CommentOptions, commentID int64, body string) (*CommentResponse, error)
UpdateComment updates an existing comment.
type GitHubClientConfig ¶
GitHubClientConfig holds configuration for creating a GitHub client.
type GitHubEnv ¶
type GitHubEnv struct {
Token string
Repository string // "owner/repo" format
SHA string
APIURL string
}
GitHubEnv holds environment variables from GitHub Actions.
func LoadGitHubEnv ¶
LoadGitHubEnv loads GitHub Actions environment variables. Returns an error only if GITHUB_TOKEN is missing.
func LoadGitHubEnvWithPR ¶ added in v1.0.0
LoadGitHubEnvWithPR loads GitHub Actions environment variables including PR number. Returns nil for env if not in a GitHub Actions environment.