mirror of
				https://kkgithub.com/actions/checkout
				synced 2025-10-31 22:31:56 +08:00 
			
		
		
		
	.
This commit is contained in:
		
							
								
								
									
										20
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @ -483,21 +483,25 @@ class GitAuthHelper { | |||||||
|             // Remove HTTP extra header
 |             // Remove HTTP extra header
 | ||||||
|             yield this.removeGitConfig(this.tokenConfigKey); |             yield this.removeGitConfig(this.tokenConfigKey); | ||||||
|             yield this.removeSubmoduleGitConfig(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
 |             // 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
 |             // Remove submodule includeIf entries that point to git-credentials-*.config files
 | ||||||
|             const submoduleConfigPaths = yield this.git.getSubmoduleConfigPaths(true); |             const submoduleConfigPaths = yield this.git.getSubmoduleConfigPaths(true); | ||||||
|             for (const configPath of submoduleConfigPaths) { |             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
 |             // Remove credentials config files
 | ||||||
|             if (this.credentialsConfigPath) { |             for (const credentialsPath of credentialsPaths) { | ||||||
|                 try { |                 try { | ||||||
|                     yield io.rmRF(this.credentialsConfigPath); |                     yield io.rmRF(credentialsPath); | ||||||
|                 } |                 } | ||||||
|                 catch (err) { |                 catch (err) { | ||||||
|                     core.debug(`${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : 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. |      * Removes includeIf entries that point to git-credentials-*.config files. | ||||||
|      * @param configPath Optional path to a specific git config file to operate on |      * @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) { |     removeIncludeIfCredentials(configPath) { | ||||||
|         return __awaiter(this, void 0, void 0, function* () { |         return __awaiter(this, void 0, void 0, function* () { | ||||||
|  |             const credentialsPaths = new Set(); | ||||||
|             try { |             try { | ||||||
|                 // Get all includeIf.gitdir keys
 |                 // Get all includeIf.gitdir keys
 | ||||||
|                 const keys = yield this.git.tryGetConfigKeys('^includeIf\\.gitdir:', false, configPath); |                 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
 |                         // Remove only values that match git-credentials-<uuid>.config pattern
 | ||||||
|                         for (const value of values) { |                         for (const value of values) { | ||||||
|                             if (this.testCredentialsConfigPath(value)) { |                             if (this.testCredentialsConfigPath(value)) { | ||||||
|  |                                 credentialsPaths.add(value); | ||||||
|                                 yield this.git.tryConfigUnsetValue(key, value, false, configPath); |                                 yield this.git.tryConfigUnsetValue(key, value, false, configPath); | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
| @ -558,6 +565,7 @@ class GitAuthHelper { | |||||||
|                     core.debug(`Error during includeIf cleanup: ${err}`); |                     core.debug(`Error during includeIf cleanup: ${err}`); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |             return Array.from(credentialsPaths); | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -455,23 +455,28 @@ class GitAuthHelper { | |||||||
|     await this.removeGitConfig(this.tokenConfigKey) |     await this.removeGitConfig(this.tokenConfigKey) | ||||||
|     await this.removeSubmoduleGitConfig(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 |     // 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 |     // Remove submodule includeIf entries that point to git-credentials-*.config files | ||||||
|     const submoduleConfigPaths = await this.git.getSubmoduleConfigPaths(true) |     const submoduleConfigPaths = await this.git.getSubmoduleConfigPaths(true) | ||||||
|     for (const configPath of submoduleConfigPaths) { |     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 |     // Remove credentials config files | ||||||
|     if (this.credentialsConfigPath) { |     for (const credentialsPath of credentialsPaths) { | ||||||
|       try { |       try { | ||||||
|         await io.rmRF(this.credentialsConfigPath) |         await io.rmRF(credentialsPath) | ||||||
|       } catch (err) { |       } catch (err) { | ||||||
|         core.debug(`${(err as any)?.message ?? err}`) |         core.debug(`${(err as any)?.message ?? err}`) | ||||||
|         core.warning( |         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. |    * Removes includeIf entries that point to git-credentials-*.config files. | ||||||
|    * @param configPath Optional path to a specific git config file to operate on |    * @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 { |     try { | ||||||
|       // Get all includeIf.gitdir keys |       // Get all includeIf.gitdir keys | ||||||
|       const keys = await this.git.tryGetConfigKeys('^includeIf\\.gitdir:', false, configPath) |       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 |           // Remove only values that match git-credentials-<uuid>.config pattern | ||||||
|           for (const value of values) { |           for (const value of values) { | ||||||
|             if (this.testCredentialsConfigPath(value)) { |             if (this.testCredentialsConfigPath(value)) { | ||||||
|  |               credentialsPaths.add(value) | ||||||
|               await this.git.tryConfigUnsetValue(key, value, false, configPath) |               await this.git.tryConfigUnsetValue(key, value, false, configPath) | ||||||
|             } |             } | ||||||
|           } |           } | ||||||
| @ -533,6 +542,8 @@ class GitAuthHelper { | |||||||
|         core.debug(`Error during includeIf cleanup: ${err}`) |         core.debug(`Error during includeIf cleanup: ${err}`) | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     return Array.from(credentialsPaths) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 eric sciple
					eric sciple