Skip to content

Commit 789256a

Browse files
nodeselectorCopilot
andcommitted
fix: silently skip run-only workflows with no action refs
Workflows that only have run: steps and no uses: directives have nothing to pin. Previously these would emit a misleading 'not yet pinned' skip message. Now they're skipped silently since there's no action to take. Three tiers: - No uses: at all → skip silently - Has uses: but no dependencies: section → 'not yet pinned' skip - Has dependencies: → validate normally Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d5f8e3c commit 789256a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

root.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616

1717
var errSilent = errors.New("silent error")
1818
var errNoDeps = errors.New("no dependencies: section found")
19+
var errNoActions = errors.New("no action references found")
1920
var newResolver = resolver.New
2021

2122
type pinOptions struct {
@@ -362,6 +363,10 @@ func runCheck(opts *checkOptions) error {
362363
}
363364
result, err := validateOneFile(workflowPath, r)
364365
if err != nil {
366+
if errors.Is(err, errNoActions) {
367+
// Workflow has only run: steps, no actions to pin — skip silently.
368+
continue
369+
}
365370
if errors.Is(err, errNoDeps) {
366371
if opts.JSONFields != "" {
367372
aggregate.Warnings = append(aggregate.Warnings,
@@ -725,6 +730,12 @@ func validateOneFile(workflowPath string, r *resolver.Resolver) (*validationResu
725730
return nil, err
726731
}
727732
if len(existingDeps) == 0 {
733+
// Check if the workflow even has action references.
734+
// Run-only workflows (no uses: directives) need no pinning.
735+
refs, _, _ := wf.ExtractActionRefs()
736+
if len(refs) == 0 {
737+
return nil, errNoActions
738+
}
728739
return nil, errNoDeps
729740
}
730741

0 commit comments

Comments
 (0)