@@ -12,14 +12,28 @@ export async function createBranchForce(branch: string): Promise<void> {
1212 return ;
1313}
1414
15- export async function copyAssets ( publishDir : string , destDir : string ) : Promise < void > {
15+ export async function copyAssets (
16+ publishDir : string ,
17+ destDir : string ,
18+ excludeAssets : string
19+ ) : Promise < void > {
1620 const copyOpts = { recursive : true , force : true } ;
1721 const files = fs . readdirSync ( publishDir ) ;
1822 core . debug ( `${ files } ` ) ;
1923 for await ( const file of files ) {
20- if ( file . endsWith ( '.git' ) || file . endsWith ( '.github' ) ) {
24+ const isExcludeFile = ( ( ) : boolean => {
25+ const excludedAssetNames : Array < string > = excludeAssets . split ( ',' ) ;
26+ for ( const excludedAssetName of excludedAssetNames ) {
27+ if ( file === excludedAssetName ) {
28+ return true ;
29+ }
30+ }
31+ return false ;
32+ } ) ( ) ;
33+ if ( isExcludeFile || file === '.git' ) {
2134 continue ;
2235 }
36+
2337 const filePublishPath = path . join ( publishDir , file ) ;
2438 const fileDestPath = path . join ( destDir , file ) ;
2539 const destPath = path . dirname ( fileDestPath ) ;
@@ -54,7 +68,7 @@ export async function setRepo(inps: Inputs, remoteURL: string, workDir: string):
5468 await createDir ( destDir ) ;
5569 process . chdir ( workDir ) ;
5670 await createBranchForce ( inps . PublishBranch ) ;
57- await copyAssets ( publishDir , destDir ) ;
71+ await copyAssets ( publishDir , destDir , inps . ExcludeAssets ) ;
5872 return ;
5973 }
6074
@@ -96,7 +110,7 @@ export async function setRepo(inps: Inputs, remoteURL: string, workDir: string):
96110 }
97111 }
98112
99- await copyAssets ( publishDir , destDir ) ;
113+ await copyAssets ( publishDir , destDir , inps . ExcludeAssets ) ;
100114 process . chdir ( workDir ) ;
101115 return ;
102116 } else {
@@ -108,7 +122,7 @@ export async function setRepo(inps: Inputs, remoteURL: string, workDir: string):
108122 await createDir ( destDir ) ;
109123 process . chdir ( workDir ) ;
110124 await createBranchForce ( inps . PublishBranch ) ;
111- await copyAssets ( publishDir , destDir ) ;
125+ await copyAssets ( publishDir , destDir , inps . ExcludeAssets ) ;
112126 return ;
113127 }
114128}
0 commit comments