Documentation
¶
Index ¶
- Constants
- func RenderCommentMarkdown(req *Request, report *ActionReport) string
- func RenderHTMLReport(data HTMLReportData) (string, error)
- func RenderSummaryMarkdown(req *Request, report *ActionReport) string
- func StatusFromCounts(changed bool, warnings int, errors int) string
- func StringSlice(v []string) []string
- func TruncateDiff(full string, maxBytes, maxLines int) (preview string, truncated bool)
- type ActionReport
- type ChangeBreakdown
- type HTMLDiffRow
- type HTMLReportData
- type HTMLReportMeta
- type HTMLReportPolicies
- type HTMLReportSummary
- type HTMLResourceChange
- type ReportInput
- type Request
- func (r *Request) ConfigRoot() string
- func (r *Request) DiffLeft() string
- func (r *Request) DiffRight() string
- func (r *Request) HasConfig() bool
- func (r *Request) IsLegacy() bool
- func (r *Request) ShouldComment(report *ActionReport) bool
- func (r *Request) ShouldDeleteComment(report *ActionReport) bool
- func (r *Request) ShouldFail(report *ActionReport) bool
Constants ¶
const ( StatusClean = "clean" StatusChanged = "changed" StatusWarning = "warning" StatusError = "error" )
Status values for ActionReport.
Variables ¶
This section is empty.
Functions ¶
func RenderCommentMarkdown ¶
func RenderCommentMarkdown(req *Request, report *ActionReport) string
RenderCommentMarkdown generates a PR comment markdown document.
func RenderHTMLReport ¶
func RenderHTMLReport(data HTMLReportData) (string, error)
func RenderSummaryMarkdown ¶
func RenderSummaryMarkdown(req *Request, report *ActionReport) string
RenderSummaryMarkdown generates a GitHub Step Summary markdown document.
func StatusFromCounts ¶
StatusFromCounts derives the overall status from changes, warnings, and errors.
func StringSlice ¶
StringSlice returns a stable string slice for use in markdown tables.
Types ¶
type ActionReport ¶
type ActionReport struct {
Status string `json:"status"`
Changed bool `json:"changed"`
Warnings []string `json:"warnings,omitempty"`
Errors []string `json:"errors,omitempty"`
DiffBytes int `json:"diff_bytes"`
DiffTruncated bool `json:"diff_truncated"`
DiffPreview string `json:"diff_preview,omitempty"`
DiffFile string `json:"diff_file,omitempty"`
SummaryFile string `json:"summary_file,omitempty"`
CommentFile string `json:"comment_file,omitempty"`
ReportFile string `json:"report_file,omitempty"`
HTMLReportFile string `json:"html_report_file,omitempty"`
ExportDir string `json:"export_dir,omitempty"`
ResourcesAdded int `json:"resources_added"`
ResourcesModified int `json:"resources_modified"`
ResourcesDeleted int `json:"resources_deleted"`
ResourcesTotal int `json:"resources_total"`
ByKind map[string]int `json:"by_kind,omitempty"`
KindBreakdown map[string]diff.ChangeBreakdown `json:"kind_breakdown,omitempty"`
ByProducer map[string]int `json:"by_producer,omitempty"`
ByCluster map[string]diff.ChangeBreakdown `json:"by_cluster,omitempty"`
Classifications []policy.Classification `json:"classifications,omitempty"`
Violations []policy.Violation `json:"violations,omitempty"`
Labels []string `json:"labels,omitempty"`
PolicyFailures []string `json:"policy_failures,omitempty"`
PolicyFailed bool `json:"policy_failed"`
AIAssessment *ai.Assessment `json:"ai_assessment,omitempty"`
}
ActionReport is the structured result of a GitHub Action run.
func BuildReport ¶
func BuildReport(input ReportInput) *ActionReport
BuildReport assembles the shared impact report used by CLI and GitHub Action adapters.
type ChangeBreakdown ¶
type ChangeBreakdown = diff.ChangeBreakdown
ChangeBreakdown is an alias for diff.ChangeBreakdown for backward compatibility.
type HTMLDiffRow ¶
type HTMLReportData ¶
type HTMLReportData struct {
Meta HTMLReportMeta `json:"meta"`
Summary HTMLReportSummary `json:"summary"`
Policies HTMLReportPolicies `json:"policies"`
AI *ai.Assessment `json:"ai,omitempty"`
Resources []HTMLResourceChange `json:"resources"`
}
func BuildHTMLReportData ¶
func BuildHTMLReportData(req *Request, report *ActionReport, result *fmpdiff.DiffResult) HTMLReportData
type HTMLReportMeta ¶
type HTMLReportPolicies ¶
type HTMLReportPolicies struct {
Classifications []policy.Classification `json:"classifications,omitempty"`
Violations []policy.Violation `json:"violations,omitempty"`
Labels []string `json:"labels,omitempty"`
PolicyFailures []string `json:"policyFailures,omitempty"`
PolicyFailed bool `json:"policyFailed"`
}
type HTMLReportSummary ¶
type HTMLReportSummary struct {
Added int `json:"added"`
Modified int `json:"modified"`
Deleted int `json:"deleted"`
Total int `json:"total"`
KindBreakdown map[string]ChangeBreakdown `json:"kindBreakdown,omitempty"`
ClusterBreakdown map[string]ChangeBreakdown `json:"clusterBreakdown,omitempty"`
}
type HTMLResourceChange ¶
type HTMLResourceChange struct {
Index int `json:"index"`
ID string `json:"id"`
Action string `json:"action"`
Cluster string `json:"cluster"`
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Namespace string `json:"namespace"`
Name string `json:"name"`
LogicalID string `json:"logicalId,omitempty"`
Slot string `json:"slot,omitempty"`
Producer string `json:"producer"`
AddedLines int `json:"addedLines"`
DeletedLines int `json:"deletedLines"`
DiffRows []HTMLDiffRow `json:"diffRows"`
Truncated bool `json:"truncated,omitempty"`
}
type ReportInput ¶
type ReportInput struct {
Result *diff.DiffResult
PolicyResult *policy.Result
Warnings []string
FullDiff string
MaxInlineDiffBytes int
DiffPreviewLines int
AIAssessment *ai.Assessment
}
ReportInput contains the domain data needed to assemble an impact report.
type Request ¶
type Request struct {
// Diff targets
Repo string
BaseRef string
BaseSHA string
RepoA string
RepoB string
Paths []string
// Cluster mode: map of cluster name → list of paths.
// Derived from the "clusters" input and from prefixed "paths" entries.
ClusterPaths map[string][]string
// Render options
Recursive bool
RenderHelm bool
ResolveGit bool
Sort bool
ExcludeCRDs bool
SOPSDecrypt bool
HelmRelease string
ConfigFile string
FilterFile string
FilterYAML string
RegistryConfig string
RepositoryConfig string
RepositoryCache string
Crossplane bool
CrossplaneEngine string
CrossplaneFunctions []string
FluxPlugin string
CrossplanePlugin string
// Export
ExportDir string
ExportChangedOnly bool
// Reporting
WriteSummary bool
Comment bool
CommentMode string // changes, always, failure
MaxInlineDiffBytes int
DiffPreviewLines int
HTMLReport bool
HTMLReportName string
HTMLReportRetentionDays int
HTMLReportMaxResourceDiffBytes int
AIAssessment string
AIProvider string
AIModel string
AIFailOnError string
// Policy
FailOnWarning bool
FailOnError bool
}
Request captures normalized inputs for the GitHub Action mode.
func ParseRequestFromEnv ¶
ParseRequestFromEnv builds a Request from GitHub Actions inputs (passed as env vars).
func (*Request) ConfigRoot ¶
ConfigRoot returns the directory to search for repository configuration.
func (*Request) HasConfig ¶
HasConfig returns true if an explicit config file or auto-discoverable config should be used.
func (*Request) ShouldComment ¶
func (r *Request) ShouldComment(report *ActionReport) bool
ShouldComment returns true if a comment should be posted/updated for this report.
func (*Request) ShouldDeleteComment ¶
func (r *Request) ShouldDeleteComment(report *ActionReport) bool
ShouldDeleteComment returns true when an existing comment should be deleted (no longer relevant).
func (*Request) ShouldFail ¶
func (r *Request) ShouldFail(report *ActionReport) bool
ShouldFail returns true if the request says we should fail for the current report state.