mirror of
				https://github.com/actions/checkout.git
				synced 2025-10-31 02:14:20 +08:00 
			
		
		
		
	.
This commit is contained in:
		
							parent
							
								
									f8060825ea
								
							
						
					
					
						commit
						c9518fb408
					
				
							
								
								
									
										20
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @ -483,21 +483,25 @@ class GitAuthHelper { | ||||
|             // Remove HTTP extra header
 | ||||
|             yield this.removeGitConfig(this.tokenConfigKey); | ||||
|             yield this.removeSubmoduleGitConfig(this.tokenConfigKey); | ||||
|             // Collect credentials config paths that need to be removed
 | ||||
|             const credentialsPaths = new Set(); | ||||
|             // Remove includeIf entries that point to git-credentials-*.config files
 | ||||
|             yield this.removeIncludeIfCredentials(); | ||||
|             const mainCredentialsPaths = yield this.removeIncludeIfCredentials(); | ||||
|             mainCredentialsPaths.forEach(path => credentialsPaths.add(path)); | ||||
|             // Remove submodule includeIf entries that point to git-credentials-*.config files
 | ||||
|             const submoduleConfigPaths = yield this.git.getSubmoduleConfigPaths(true); | ||||
|             for (const configPath of submoduleConfigPaths) { | ||||
|                 yield this.removeIncludeIfCredentials(configPath); | ||||
|                 const submoduleCredentialsPaths = yield this.removeIncludeIfCredentials(configPath); | ||||
|                 submoduleCredentialsPaths.forEach(path => credentialsPaths.add(path)); | ||||
|             } | ||||
|             // Remove credentials config file
 | ||||
|             if (this.credentialsConfigPath) { | ||||
|             // Remove credentials config files
 | ||||
|             for (const credentialsPath of credentialsPaths) { | ||||
|                 try { | ||||
|                     yield io.rmRF(this.credentialsConfigPath); | ||||
|                     yield io.rmRF(credentialsPath); | ||||
|                 } | ||||
|                 catch (err) { | ||||
|                     core.debug(`${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`); | ||||
|                     core.warning(`Failed to remove credentials config '${this.credentialsConfigPath}'`); | ||||
|                     core.warning(`Failed to remove credentials config '${credentialsPath}'`); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
| @ -530,9 +534,11 @@ class GitAuthHelper { | ||||
|     /** | ||||
|      * Removes includeIf entries that point to git-credentials-*.config files. | ||||
|      * @param configPath Optional path to a specific git config file to operate on | ||||
|      * @returns Array of unique credentials config file paths that were found and removed | ||||
|      */ | ||||
|     removeIncludeIfCredentials(configPath) { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             const credentialsPaths = new Set(); | ||||
|             try { | ||||
|                 // Get all includeIf.gitdir keys
 | ||||
|                 const keys = yield this.git.tryGetConfigKeys('^includeIf\\.gitdir:', false, configPath); | ||||
| @ -543,6 +549,7 @@ class GitAuthHelper { | ||||
|                         // Remove only values that match git-credentials-<uuid>.config pattern
 | ||||
|                         for (const value of values) { | ||||
|                             if (this.testCredentialsConfigPath(value)) { | ||||
|                                 credentialsPaths.add(value); | ||||
|                                 yield this.git.tryConfigUnsetValue(key, value, false, configPath); | ||||
|                             } | ||||
|                         } | ||||
| @ -558,6 +565,7 @@ class GitAuthHelper { | ||||
|                     core.debug(`Error during includeIf cleanup: ${err}`); | ||||
|                 } | ||||
|             } | ||||
|             return Array.from(credentialsPaths); | ||||
|         }); | ||||
|     } | ||||
|     /** | ||||
|  | ||||
| @ -455,23 +455,28 @@ class GitAuthHelper { | ||||
|     await this.removeGitConfig(this.tokenConfigKey) | ||||
|     await this.removeSubmoduleGitConfig(this.tokenConfigKey) | ||||
| 
 | ||||
|     // Collect credentials config paths that need to be removed
 | ||||
|     const credentialsPaths = new Set<string>() | ||||
| 
 | ||||
|     // Remove includeIf entries that point to git-credentials-*.config files
 | ||||
|     await this.removeIncludeIfCredentials() | ||||
|     const mainCredentialsPaths = await this.removeIncludeIfCredentials() | ||||
|     mainCredentialsPaths.forEach(path => credentialsPaths.add(path)) | ||||
| 
 | ||||
|     // Remove submodule includeIf entries that point to git-credentials-*.config files
 | ||||
|     const submoduleConfigPaths = await this.git.getSubmoduleConfigPaths(true) | ||||
|     for (const configPath of submoduleConfigPaths) { | ||||
|       await this.removeIncludeIfCredentials(configPath) | ||||
|       const submoduleCredentialsPaths = await this.removeIncludeIfCredentials(configPath) | ||||
|       submoduleCredentialsPaths.forEach(path => credentialsPaths.add(path)) | ||||
|     } | ||||
| 
 | ||||
|     // Remove credentials config file
 | ||||
|     if (this.credentialsConfigPath) { | ||||
|     // Remove credentials config files
 | ||||
|     for (const credentialsPath of credentialsPaths) { | ||||
|       try { | ||||
|         await io.rmRF(this.credentialsConfigPath) | ||||
|         await io.rmRF(credentialsPath) | ||||
|       } catch (err) { | ||||
|         core.debug(`${(err as any)?.message ?? err}`) | ||||
|         core.warning( | ||||
|           `Failed to remove credentials config '${this.credentialsConfigPath}'` | ||||
|           `Failed to remove credentials config '${credentialsPath}'` | ||||
|         ) | ||||
|       } | ||||
|     } | ||||
| @ -507,8 +512,11 @@ class GitAuthHelper { | ||||
|   /** | ||||
|    * Removes includeIf entries that point to git-credentials-*.config files. | ||||
|    * @param configPath Optional path to a specific git config file to operate on | ||||
|    * @returns Array of unique credentials config file paths that were found and removed | ||||
|    */ | ||||
|   private async removeIncludeIfCredentials(configPath?: string): Promise<void> { | ||||
|   private async removeIncludeIfCredentials(configPath?: string): Promise<string[]> { | ||||
|     const credentialsPaths = new Set<string>() | ||||
|      | ||||
|     try { | ||||
|       // Get all includeIf.gitdir keys
 | ||||
|       const keys = await this.git.tryGetConfigKeys('^includeIf\\.gitdir:', false, configPath) | ||||
| @ -520,6 +528,7 @@ class GitAuthHelper { | ||||
|           // Remove only values that match git-credentials-<uuid>.config pattern
 | ||||
|           for (const value of values) { | ||||
|             if (this.testCredentialsConfigPath(value)) { | ||||
|               credentialsPaths.add(value) | ||||
|               await this.git.tryConfigUnsetValue(key, value, false, configPath) | ||||
|             } | ||||
|           } | ||||
| @ -533,6 +542,8 @@ class GitAuthHelper { | ||||
|         core.debug(`Error during includeIf cleanup: ${err}`) | ||||
|       } | ||||
|     } | ||||
|      | ||||
|     return Array.from(credentialsPaths) | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 eric sciple
						eric sciple