Skip to content

Commit 4fda526

Browse files
nodeselectorCopilot
andcommitted
fix: drop 'ask maintainer to onboard' message for transitive deps
Actions don't onboard onto dependency pinning — that message was misleading. Keep only the provenance lines (parent action + workflows). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b2eb5c2 commit 4fda526

1 file changed

Lines changed: 3 additions & 20 deletions

File tree

cmd/gh-actions-pin/check.go

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -542,19 +542,16 @@ func presentCheckResults(out *ui.UI, report *doctor.Report, valid bool, willReme
542542
depKey := f.DepKey()
543543
switch {
544544
case f.Category == doctor.CategorySHAAsRef:
545-
// Transitive deps — shown individually since remediation differs.
546-
repoNWO := extractRepoNWO(depKey)
547545
out.Warning("%s: transitive dependency pinned to a bare SHA — reachability cannot be verified", depKey)
548-
printTransitiveContext(out, f.ParentNWO, wg.workflows, repoNWO)
546+
printTransitiveContext(out, f.ParentNWO, wg.workflows)
549547
case f.Category == doctor.CategoryValid && f.Severity == doctor.SeverityWarning:
550548
label := depKey
551549
if label == "" {
552550
label = f.WorkflowPath
553551
}
554552
if strings.Contains(f.Remediation, "transitive dependency") {
555-
repoNWO := extractRepoNWO(label)
556553
out.Warning("%s: transitive dependency pinned to a bare SHA — reachability cannot be verified", label)
557-
printTransitiveContext(out, f.ParentNWO, wg.workflows, repoNWO)
554+
printTransitiveContext(out, f.ParentNWO, wg.workflows)
558555
} else {
559556
out.Warning("%s: %s", label, f.Detail)
560557
}
@@ -563,7 +560,7 @@ func presentCheckResults(out *ui.UI, report *doctor.Report, valid bool, willReme
563560
}
564561

565562
// printTransitiveContext prints ↳ lines for a transitive dep finding.
566-
func printTransitiveContext(out *ui.UI, parentNWO string, workflows []string, repoNWO string) {
563+
func printTransitiveContext(out *ui.UI, parentNWO string, workflows []string) {
567564
if parentNWO != "" {
568565
out.Detail(" ↳ pulled in by %s", out.Bold(parentNWO))
569566
} else {
@@ -572,7 +569,6 @@ func printTransitiveContext(out *ui.UI, parentNWO string, workflows []string, re
572569
if len(workflows) > 0 {
573570
out.Detail(" ↳ in %s", ui.Pluralize(len(workflows), "workflow", "workflows")+": "+formatWorkflowPaths(workflows))
574571
}
575-
out.Detail(" ↳ ask the maintainer of %s to onboard to dependency pinning", out.Bold(repoNWO))
576572
}
577573

578574
// formatWorkflowPaths formats a list of workflow paths for display.
@@ -582,16 +578,3 @@ func formatWorkflowPaths(paths []string) string {
582578
}
583579
return strings.Join(paths[:3], ", ") + fmt.Sprintf(" (+%d more)", len(paths)-3)
584580
}
585-
586-
// extractRepoNWO strips sub-path and ref from a dep key like "owner/repo/sub@ref".
587-
func extractRepoNWO(depKey string) string {
588-
nwo := depKey
589-
if idx := strings.Index(nwo, "@"); idx > 0 {
590-
nwo = nwo[:idx]
591-
}
592-
parts := strings.SplitN(nwo, "/", 3)
593-
if len(parts) >= 2 {
594-
return parts[0] + "/" + parts[1]
595-
}
596-
return nwo
597-
}

0 commit comments

Comments
 (0)