@@ -47,8 +47,8 @@ struct Args {
47
47
#[ arg( long, value_enum) ]
48
48
format : Option < OutputFormat > ,
49
49
50
- /// The workflow filename or directory to audit.
51
- input : PathBuf ,
50
+ /// The workflow filenames or directories to audit.
51
+ inputs : Vec < PathBuf > ,
52
52
}
53
53
54
54
#[ derive( Debug , Copy , Clone , ValueEnum ) ]
@@ -70,32 +70,35 @@ fn main() -> Result<()> {
70
70
let config = AuditConfig :: from ( & args) ;
71
71
72
72
let mut workflow_paths = vec ! [ ] ;
73
- if args. input . is_file ( ) {
74
- workflow_paths. push ( args. input . clone ( ) ) ;
75
- } else if args. input . is_dir ( ) {
76
- let mut absolute = std:: fs:: canonicalize ( & args. input ) ?;
77
- if !absolute. ends_with ( ".github/workflows" ) {
78
- absolute. push ( ".github/workflows" )
79
- }
73
+ for input in args. inputs {
74
+ if input. is_file ( ) {
75
+ workflow_paths. push ( input. clone ( ) ) ;
76
+ } else if input. is_dir ( ) {
77
+ let mut absolute = std:: fs:: canonicalize ( & input) ?;
78
+ if !absolute. ends_with ( ".github/workflows" ) {
79
+ absolute. push ( ".github/workflows" )
80
+ }
80
81
81
- log:: debug!( "collecting workflows from {absolute:?}" ) ;
82
+ log:: debug!( "collecting workflows from {absolute:?}" ) ;
82
83
83
- for entry in std:: fs:: read_dir ( absolute) ? {
84
- let workflow_path = entry?. path ( ) ;
85
- match workflow_path. extension ( ) {
86
- Some ( ext) if ext == "yml" || ext == "yaml" => workflow_paths. push ( workflow_path) ,
87
- _ => continue ,
84
+ for entry in std:: fs:: read_dir ( absolute) ? {
85
+ let workflow_path = entry?. path ( ) ;
86
+ match workflow_path. extension ( ) {
87
+ Some ( ext) if ext == "yml" || ext == "yaml" => workflow_paths. push ( workflow_path) ,
88
+ _ => continue ,
89
+ }
88
90
}
89
- }
90
91
91
- if workflow_paths. is_empty ( ) {
92
- return Err ( anyhow ! (
93
- "no workflow files collected; empty or wrong directory?"
94
- ) ) ;
92
+ if workflow_paths. is_empty ( ) {
93
+ return Err ( anyhow ! (
94
+ "no workflow files collected; empty or wrong directory?"
95
+ ) ) ;
96
+ }
97
+ } else {
98
+ return Err ( anyhow ! ( "input malformed, expected file or directory" ) ) ;
95
99
}
96
- } else {
97
- return Err ( anyhow ! ( "input must be a single workflow file or directory" ) ) ;
98
100
}
101
+ log:: debug!( "collected workflows: {workflows:?}" , workflows = workflow_paths) ;
99
102
100
103
let audit_state = AuditState :: new ( config) ;
101
104
0 commit comments