Do not delete cwd (#86)
This commit is contained in:
		
							parent
							
								
									cc70598ce8
								
							
						
					
					
						commit
						689bf84be4
					
				
							
								
								
									
										8
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							@ -4978,8 +4978,12 @@ function getSource(settings) {
 | 
				
			|||||||
        // Try prepare existing directory, otherwise recreate
 | 
					        // Try prepare existing directory, otherwise recreate
 | 
				
			||||||
        if (isExisting &&
 | 
					        if (isExisting &&
 | 
				
			||||||
            !(yield tryPrepareExistingDirectory(git, settings.repositoryPath, repositoryUrl, settings.clean))) {
 | 
					            !(yield tryPrepareExistingDirectory(git, settings.repositoryPath, repositoryUrl, settings.clean))) {
 | 
				
			||||||
            yield io.rmRF(settings.repositoryPath);
 | 
					            // Delete the contents of the directory. Don't delete the directory itself
 | 
				
			||||||
            yield io.mkdirP(settings.repositoryPath);
 | 
					            // since it may be the current working directory.
 | 
				
			||||||
 | 
					            core.info(`Deleting the contents of '${settings.repositoryPath}'`);
 | 
				
			||||||
 | 
					            for (const file of yield fs.promises.readdir(settings.repositoryPath)) {
 | 
				
			||||||
 | 
					                yield io.rmRF(path.join(settings.repositoryPath, file));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // Initialize the repository
 | 
					        // Initialize the repository
 | 
				
			||||||
        if (!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))) {
 | 
					        if (!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))) {
 | 
				
			||||||
 | 
				
			|||||||
@ -59,8 +59,12 @@ export async function getSource(settings: ISourceSettings): Promise<void> {
 | 
				
			|||||||
      settings.clean
 | 
					      settings.clean
 | 
				
			||||||
    ))
 | 
					    ))
 | 
				
			||||||
  ) {
 | 
					  ) {
 | 
				
			||||||
    await io.rmRF(settings.repositoryPath)
 | 
					    // Delete the contents of the directory. Don't delete the directory itself
 | 
				
			||||||
    await io.mkdirP(settings.repositoryPath)
 | 
					    // since it may be the current working directory.
 | 
				
			||||||
 | 
					    core.info(`Deleting the contents of '${settings.repositoryPath}'`)
 | 
				
			||||||
 | 
					    for (const file of await fs.promises.readdir(settings.repositoryPath)) {
 | 
				
			||||||
 | 
					      await io.rmRF(path.join(settings.repositoryPath, file))
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Initialize the repository
 | 
					  // Initialize the repository
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user