@@ -15,6 +15,8 @@ import (
1515)
1616
1717var errSilent = errors .New ("silent error" )
18+ var errNoDeps = errors .New ("no dependencies: section found" )
19+ var errNoActions = errors .New ("no action references found" )
1820var newResolver = resolver .New
1921
2022type pinOptions struct {
@@ -360,6 +362,19 @@ func runCheck(opts *checkOptions) error {
360362 }
361363 result , err := validateOneFile (workflowPath , r )
362364 if err != nil {
365+ if errors .Is (err , errNoActions ) {
366+ // Workflow has only run: steps, no actions to pin — skip silently.
367+ continue
368+ }
369+ if errors .Is (err , errNoDeps ) {
370+ if opts .JSONFields != "" {
371+ aggregate .Warnings = append (aggregate .Warnings ,
372+ fmt .Sprintf ("%s: not yet pinned (run `gh actions-pin --write` first)" , workflowPath ))
373+ } else {
374+ fmt .Fprintf (os .Stderr , "skipping %s: not yet pinned (run `gh actions-pin --write` first)\n " , workflowPath )
375+ }
376+ continue
377+ }
363378 aggregate .Valid = false
364379 aggregate .Errors = append (aggregate .Errors , validationError {
365380 Type : "ERROR" ,
@@ -391,6 +406,18 @@ func runCheck(opts *checkOptions) error {
391406 return nil
392407 }
393408
409+ // Print errors and warnings in human-readable mode.
410+ // Skip ERROR entries — those were already printed inline when validateOneFile returned an error.
411+ for _ , e := range aggregate .Errors {
412+ if e .Type == "ERROR" {
413+ continue
414+ }
415+ fmt .Fprintf (os .Stderr , "error: [%s] %s: %s\n " , e .Type , e .Dependency , e .Details )
416+ }
417+ for _ , w := range aggregate .Warnings {
418+ fmt .Fprintf (os .Stderr , "warning: %s\n " , w )
419+ }
420+
394421 return errSilent
395422}
396423
@@ -684,7 +711,13 @@ func validateOneFile(workflowPath string, r *resolver.Resolver) (*validationResu
684711 return nil , err
685712 }
686713 if len (existingDeps ) == 0 {
687- return nil , fmt .Errorf ("no dependencies: section found -- run `gh actions-pin --write` first" )
714+ // Check if the workflow even has action references.
715+ // Run-only workflows (no uses: directives) need no pinning.
716+ refs , _ , _ := wf .ExtractActionRefs ()
717+ if len (refs ) == 0 {
718+ return nil , errNoActions
719+ }
720+ return nil , errNoDeps
688721 }
689722
690723 refs , _ , parseWarnings := wf .ExtractActionRefs ()
0 commit comments