@@ -7,6 +7,7 @@ import os from 'os';
77import path from 'path' ;
88import { OctokitApi } from '../types/auth' ;
99import markdownEscape from 'markdown-escape' ;
10+ import { globSync } from 'glob' ;
1011
1112export async function getInputs ( inp : { api : OctokitApi , repoData : Repo } ) : Promise < Inputs > {
1213 const { api, repoData } = inp ;
@@ -53,16 +54,36 @@ function getFiles(): Inputs.File[] {
5354 return [ ] ;
5455 }
5556
56- return parse . parseMultiInput ( files ) . map ( file => {
57+ const inputFiles : Inputs . File [ ] = [ ] ;
58+
59+ for ( const file of parse . parseMultiInput ( files ) ) {
60+ let label : string ;
61+ let filePath : string ;
62+
5763 if ( ! file . includes ( ':' ) ) {
58- return { label : path . parse ( file ) . name . toLowerCase ( ) , path : file } ;
64+ label = path . parse ( file ) . name . toLowerCase ( ) ;
65+ filePath = file ;
66+ } else {
67+ label = file . split ( ':' ) [ 0 ] ;
68+ filePath = file . split ( ':' ) . slice ( 1 ) . join ( ':' ) ;
5969 }
6070
61- const [ label , ...paths ] = file . split ( ':' ) ;
71+ const files = globSync ( filePath ) ;
72+
73+ if ( files . length > 1 ) {
74+ for ( const file of files ) {
75+ const fileName = path . parse ( file ) . name ;
76+ inputFiles . push ( { label : `${ label } -${ fileName } ` , path : file } ) ;
77+ }
78+ } else if ( files . length === 1 ) {
79+ inputFiles . push ( { label, path : files [ 0 ] } ) ;
80+ } else {
81+ console . log ( `File ${ label } not found at ${ filePath } ` ) ;
82+ core . setFailed ( `File ${ label } not found at ${ filePath } ` ) ;
83+ }
84+ }
6285
63- console . log ( `Using label ${ label } for file path ${ paths . join ( ':' ) } ` ) ;
64- return { label, path : paths . join ( ':' ) } ;
65- } ) ;
86+ return inputFiles ;
6687}
6788
6889async function getRelease ( inp : { api : OctokitApi , changes : Inputs . Change [ ] , tag : Inputs . Tag , repoData : Repo , success : boolean } ) : Promise < Inputs . Release > {
0 commit comments