report

package
v0.0.0-...-1738bad Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package report contains helpers for writing comments and updating statuses in GitHub.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Report

func Report(ctx context.Context, ghc GitHubClient, reportTemplate *template.Template, pj prowapi.ProwJob, config config.GitHubReporter) error

Report is creating/updating/removing reports in GitHub based on the state of the provided ProwJob.

func ReportComment

func ReportComment(ctx context.Context, ghc GitHubClient, reportTemplate *template.Template, pjs []prowapi.ProwJob, config config.GitHubReporter, mustCreate bool) error

ReportComment takes multiple prowjobs as input. When there are more than one prowjob, they are required to have identical refs, aka they are the same repo and the same pull request.

func ReportStatusContext

func ReportStatusContext(ctx context.Context, ghc GitHubClient, pj prowapi.ProwJob, config config.GitHubReporter) error

ReportStatusContext reports prowjob status on a PR.

func ShouldReport

func ShouldReport(pj prowapi.ProwJob, validTypes []prowapi.ProwJobType) bool

TODO(krzyzacy): Move this logic into github/reporter, once we unify all reporting logic to crier

Types

type GitHubClient

type GitHubClient interface {
	BotUserCheckerWithContext(ctx context.Context) (func(candidate string) bool, error)
	CreateStatusWithContext(ctx context.Context, org, repo, ref string, s github.Status) error
	ListIssueCommentsWithContext(ctx context.Context, org, repo string, number int) ([]github.IssueComment, error)
	CreateCommentWithContext(ctx context.Context, org, repo string, number int, comment string) error
	DeleteCommentWithContext(ctx context.Context, org, repo string, ID int) error
	EditCommentWithContext(ctx context.Context, org, repo string, ID int, comment string) error
}

GitHubClient provides a client interface to report job status updates through GitHub comments.

Jump to

Keyboard shortcuts

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