mirror of
				https://github.com/actions/checkout.git
				synced 2025-10-31 18:18:37 +08:00 
			
		
		
		
	Fix Self hosted runner issue wrt bad submodules - solution cleanup working space.
This commit is contained in:
		
							parent
							
								
									ac59398561
								
							
						
					
					
						commit
						7f14f1d824
					
				
							
								
								
									
										10
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							|  | @ -7683,6 +7683,12 @@ class GitCommandManager { | |||
|             yield this.execGit(args); | ||||
|         }); | ||||
|     } | ||||
|     submoduleStatus() { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             const output = yield this.execGit(['submodule', 'status'], true); | ||||
|             return output.exitCode === 0; | ||||
|         }); | ||||
|     } | ||||
|     tagExists(pattern) { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             const output = yield this.execGit(['tag', '--list', pattern]); | ||||
|  | @ -9436,6 +9442,10 @@ function prepareExistingDirectory(git, repositoryPath, repositoryUrl, clean, ref | |||
|                     } | ||||
|                 } | ||||
|                 core.endGroup(); | ||||
|                 // Check for submodules and delete any existing files if submodules are present
 | ||||
|                 if (!(yield git.submoduleStatus())) { | ||||
|                     remove = true; | ||||
|                 } | ||||
|                 // Clean
 | ||||
|                 if (clean) { | ||||
|                     core.startGroup('Cleaning the repository'); | ||||
|  |  | |||
|  | @ -41,6 +41,7 @@ export interface IGitCommandManager { | |||
|   submoduleForeach(command: string, recursive: boolean): Promise<string> | ||||
|   submoduleSync(recursive: boolean): Promise<void> | ||||
|   submoduleUpdate(fetchDepth: number, recursive: boolean): Promise<void> | ||||
|   submoduleStatus(): Promise<boolean> | ||||
|   tagExists(pattern: string): Promise<boolean> | ||||
|   tryClean(): Promise<boolean> | ||||
|   tryConfigUnset(configKey: string, globalConfig?: boolean): Promise<boolean> | ||||
|  | @ -357,6 +358,11 @@ class GitCommandManager { | |||
|     await this.execGit(args) | ||||
|   } | ||||
| 
 | ||||
|   async submoduleStatus(): Promise<boolean> { | ||||
|     const output = await this.execGit(['submodule', 'status'], true) | ||||
|     return output.exitCode === 0 | ||||
|   } | ||||
| 
 | ||||
|   async tagExists(pattern: string): Promise<boolean> { | ||||
|     const output = await this.execGit(['tag', '--list', pattern]) | ||||
|     return !!output.stdout.trim() | ||||
|  |  | |||
|  | @ -81,6 +81,11 @@ export async function prepareExistingDirectory( | |||
|       } | ||||
|       core.endGroup() | ||||
| 
 | ||||
|       // Check for submodules and delete any existing files if submodules are present
 | ||||
|       if (!(await git.submoduleStatus())){ | ||||
|         remove = true | ||||
|       } | ||||
| 
 | ||||
|       // Clean
 | ||||
|       if (clean) { | ||||
|         core.startGroup('Cleaning the repository') | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 SKi
						SKi