@@ -25,6 +25,7 @@ async function main() {
2525 const [ owner , repo ] = core . getInput ( "repo" , { required : true } ) . split ( "/" )
2626 const path = core . getInput ( "path" , { required : true } )
2727 const name = core . getInput ( "name" )
28+ const nameIsRegExp = core . getBooleanInput ( "name_is_regexp" )
2829 const skipUnpack = core . getBooleanInput ( "skip_unpack" )
2930 const ifNoArtifactFound = core . getInput ( "if_no_artifact_found" )
3031 let workflow = core . getInput ( "workflow" )
@@ -130,6 +131,9 @@ async function main() {
130131 }
131132 if ( searchArtifacts ) {
132133 const artifact = artifacts . find ( ( artifact ) => {
134+ if ( nameIsRegExp ) {
135+ return artifact . name . match ( name ) !== null
136+ }
133137 return artifact . name == name
134138 } )
135139 if ( ! artifact ) {
@@ -166,9 +170,12 @@ async function main() {
166170 run_id : runID ,
167171 } )
168172
169- // One artifact or all if `name` input is not specified .
173+ // One artifact if 'name' input is specified, one or more if `name` is a regular expression, all otherwise .
170174 if ( name ) {
171175 filtered = artifacts . filter ( ( artifact ) => {
176+ if ( nameIsRegExp ) {
177+ return artifact . name . match ( name ) !== null
178+ }
172179 return artifact . name == name
173180 } )
174181 if ( filtered . length == 0 ) {
@@ -238,7 +245,7 @@ async function main() {
238245 continue
239246 }
240247
241- const dir = name ? path : pathname . join ( path , artifact . name )
248+ const dir = name && ! nameIsRegExp ? path : pathname . join ( path , artifact . name )
242249
243250 fs . mkdirSync ( dir , { recursive : true } )
244251
0 commit comments