diff --git a/.github/workflows/release.lock.yml b/.github/workflows/release.lock.yml index ff08e762e0e..326a7745951 100644 --- a/.github/workflows/release.lock.yml +++ b/.github/workflows/release.lock.yml @@ -6276,13 +6276,13 @@ jobs: - name: Download Go modules run: go mod download - name: Generate SBOM (SPDX format) - uses: anchore/sbom-action@fbfd9c6c189226748411491745178e0c2017392d # v0 + uses: anchore/sbom-action@fbfd9c6c189226748411491745178e0c2017392d # v0.20.10 with: artifact-name: sbom.spdx.json format: spdx-json output-file: sbom.spdx.json - name: Generate SBOM (CycloneDX format) - uses: anchore/sbom-action@fbfd9c6c189226748411491745178e0c2017392d # v0 + uses: anchore/sbom-action@fbfd9c6c189226748411491745178e0c2017392d # v0.20.10 with: artifact-name: sbom.cdx.json format: cyclonedx-json diff --git a/pkg/cli/audit_report.go b/pkg/cli/audit_report.go index bbb4aedaf63..169a410144d 100644 --- a/pkg/cli/audit_report.go +++ b/pkg/cli/audit_report.go @@ -83,6 +83,7 @@ type OverviewData struct { Event string `json:"event" console:"header:Event"` Branch string `json:"branch" console:"header:Branch"` URL string `json:"url" console:"header:URL"` + LogsPath string `json:"logs_path,omitempty" console:"header:Files,omitempty"` } // MetricsData contains execution metrics @@ -135,6 +136,7 @@ type OverviewDisplay struct { Event string `console:"header:Event"` Branch string `console:"header:Branch"` URL string `console:"header:URL"` + Files string `console:"header:Files,omitempty"` } // buildAuditData creates structured audit data from workflow run information @@ -155,6 +157,18 @@ func buildAuditData(processedRun ProcessedRun, metrics LogMetrics) AuditData { Branch: run.HeadBranch, URL: run.URL, } + + // Convert LogsPath to relative path from workspace root + if run.LogsPath != "" { + logsPathDisplay := run.LogsPath + if cwd, err := os.Getwd(); err == nil { + if relPath, err := filepath.Rel(cwd, run.LogsPath); err == nil { + logsPathDisplay = relPath + } + } + overview.LogsPath = logsPathDisplay + } + if run.Duration > 0 { overview.Duration = timeutil.FormatDuration(run.Duration) } @@ -562,6 +576,7 @@ func renderOverview(overview OverviewData) { Event: overview.Event, Branch: overview.Branch, URL: overview.URL, + Files: overview.LogsPath, } fmt.Print(console.RenderStruct(display)) diff --git a/pkg/cli/audit_test.go b/pkg/cli/audit_test.go index 1cca9a7c0d5..51bcf15d9cf 100644 --- a/pkg/cli/audit_test.go +++ b/pkg/cli/audit_test.go @@ -707,6 +707,14 @@ func TestBuildAuditData(t *testing.T) { if auditData.Overview.Status != "completed" { t.Errorf("Expected status 'completed', got %s", auditData.Overview.Status) } + // LogsPath should be converted to relative path + if auditData.Overview.LogsPath == "" { + t.Error("Expected logs path to be set") + } + // Verify that LogsPath is relative (doesn't start with /) + if filepath.IsAbs(auditData.Overview.LogsPath) && auditData.Overview.LogsPath != run.LogsPath { + t.Errorf("Expected logs path to be relative or match original, got '%s'", auditData.Overview.LogsPath) + } // Verify metrics if auditData.Metrics.TokenUsage != 1500 {