mirror of
				https://github.com/actions/checkout.git
				synced 2025-10-31 18:18:37 +08:00 
			
		
		
		
	Compare commits
	
		
			5 Commits
		
	
	
		
			762bf756aa
			...
			2bcd7c6585
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 2bcd7c6585 | ||
|   | 857facff5c | ||
|   | ff9f98e487 | ||
|   | aa7e6581cb | ||
|   | 6397f22a4f | 
							
								
								
									
										11
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							|  | @ -299,15 +299,18 @@ jobs: | ||||||
|   test-output: |   test-output: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     steps: |     steps: | ||||||
|       # Clone this repo |       # Download the action at the current ref | ||||||
|       - name: Checkout |       - name: Checkout | ||||||
|         uses: actions/checkout@v4.1.6 |         uses: actions/checkout@v4.1.6 | ||||||
|  |         with: | ||||||
|  |           path: actions-checkout | ||||||
| 
 | 
 | ||||||
|       # Basic checkout using git |       # Basic checkout using git | ||||||
|       - name: Checkout basic |       - name: Checkout basic | ||||||
|         id: checkout |         id: checkout | ||||||
|         uses: ./ |         uses: ./actions-checkout | ||||||
|         with: |         with: | ||||||
|  |           path: cloned-using-local-action | ||||||
|           ref: test-data/v2/basic |           ref: test-data/v2/basic | ||||||
| 
 | 
 | ||||||
|       # Verify output |       # Verify output | ||||||
|  | @ -325,7 +328,3 @@ jobs: | ||||||
|             echo "Expected commit to be 82f71901cf8c021332310dcc8cdba84c4193ff5d" |             echo "Expected commit to be 82f71901cf8c021332310dcc8cdba84c4193ff5d" | ||||||
|             exit 1 |             exit 1 | ||||||
|           fi |           fi | ||||||
| 
 |  | ||||||
|       # needed to make checkout post cleanup succeed |  | ||||||
|       - name: Fix Checkout |  | ||||||
|         uses: actions/checkout@v4.1.6 |  | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ fi | ||||||
| 
 | 
 | ||||||
| echo "Testing persisted credential" | echo "Testing persisted credential" | ||||||
| pushd ./submodules-recursive/submodule-level-1/submodule-level-2 | pushd ./submodules-recursive/submodule-level-1/submodule-level-2 | ||||||
| git config --local --name-only --get-regexp http.+extraheader && git fetch | git config --local --name-only --get-regexp '^includeIf\.' && git fetch | ||||||
| if [ "$?" != "0" ]; then | if [ "$?" != "0" ]; then | ||||||
|     echo "Failed to validate persisted credential" |     echo "Failed to validate persisted credential" | ||||||
|     popd |     popd | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ fi | ||||||
| 
 | 
 | ||||||
| echo "Testing persisted credential" | echo "Testing persisted credential" | ||||||
| pushd ./submodules-true/submodule-level-1 | pushd ./submodules-true/submodule-level-1 | ||||||
| git config --local --name-only --get-regexp http.+extraheader && git fetch | git config --local --name-only --get-regexp '^includeIf\.' && git fetch | ||||||
| if [ "$?" != "0" ]; then | if [ "$?" != "0" ]; then | ||||||
|     echo "Failed to validate persisted credential" |     echo "Failed to validate persisted credential" | ||||||
|     popd |     popd | ||||||
|  |  | ||||||
							
								
								
									
										14
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							|  | @ -289,15 +289,15 @@ class GitAuthHelper { | ||||||
|                 // For each submodule, configure includeIf entries pointing to the shared credentials file.
 |                 // For each submodule, configure includeIf entries pointing to the shared credentials file.
 | ||||||
|                 // Configure both host and container paths to support Docker container actions.
 |                 // Configure both host and container paths to support Docker container actions.
 | ||||||
|                 for (const configPath of configPaths) { |                 for (const configPath of configPaths) { | ||||||
|                     // The config file is at .git/modules/submodule-name/config
 |                     // Submodule Git directory
 | ||||||
|                     let submoduleConfigDir = path.dirname(configPath); |                     let submoduleGitDir = path.dirname(configPath); // The config file is at .git/modules/submodule-name/config
 | ||||||
|                     submoduleConfigDir = submoduleConfigDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
 |                     submoduleGitDir = submoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
 | ||||||
|                     // Configure host includeIf
 |                     // Configure host includeIf
 | ||||||
|                     yield this.git.config(`includeIf.gitdir:${submoduleConfigDir}.path`, credentialsConfigPath, false, false, configPath); |                     yield this.git.config(`includeIf.gitdir:${submoduleGitDir}.path`, credentialsConfigPath, false, false, configPath); | ||||||
|                     // Configure container includeIf
 |                     // Configure container includeIf
 | ||||||
|                     let relativeSubmoduleConfigDir = path.relative(githubWorkspace, submoduleConfigDir); |                     let relativeSubmoduleGitDir = path.relative(githubWorkspace, submoduleGitDir); | ||||||
|                     relativeSubmoduleConfigDir = relativeSubmoduleConfigDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
 |                     relativeSubmoduleGitDir = relativeSubmoduleGitDir.replace(/\\/g, '/'); // Use forward slashes, even on Windows
 | ||||||
|                     const containerSubmoduleGitDir = path.posix.join('/github/workspace', relativeSubmoduleConfigDir); |                     const containerSubmoduleGitDir = path.posix.join('/github/workspace', relativeSubmoduleGitDir); | ||||||
|                     yield this.git.config(`includeIf.gitdir:${containerSubmoduleGitDir}.path`, containerCredentialsPath, false, false, configPath); |                     yield this.git.config(`includeIf.gitdir:${containerSubmoduleGitDir}.path`, containerCredentialsPath, false, false, configPath); | ||||||
|                 } |                 } | ||||||
|                 if (this.settings.sshKey) { |                 if (this.settings.sshKey) { | ||||||
|  |  | ||||||
|  | @ -205,13 +205,13 @@ class GitAuthHelper { | ||||||
|       // For each submodule, configure includeIf entries pointing to the shared credentials file.
 |       // For each submodule, configure includeIf entries pointing to the shared credentials file.
 | ||||||
|       // Configure both host and container paths to support Docker container actions.
 |       // Configure both host and container paths to support Docker container actions.
 | ||||||
|       for (const configPath of configPaths) { |       for (const configPath of configPaths) { | ||||||
|         // The config file is at .git/modules/submodule-name/config
 |         // Submodule Git directory
 | ||||||
|         let submoduleConfigDir = path.dirname(configPath) |         let submoduleGitDir = path.dirname(configPath) // The config file is at .git/modules/submodule-name/config
 | ||||||
|         submoduleConfigDir = submoduleConfigDir.replace(/\\/g, '/') // Use forward slashes, even on Windows
 |         submoduleGitDir = submoduleGitDir.replace(/\\/g, '/') // Use forward slashes, even on Windows
 | ||||||
| 
 | 
 | ||||||
|         // Configure host includeIf
 |         // Configure host includeIf
 | ||||||
|         await this.git.config( |         await this.git.config( | ||||||
|           `includeIf.gitdir:${submoduleConfigDir}.path`, |           `includeIf.gitdir:${submoduleGitDir}.path`, | ||||||
|           credentialsConfigPath, |           credentialsConfigPath, | ||||||
|           false, |           false, | ||||||
|           false, |           false, | ||||||
|  | @ -219,17 +219,14 @@ class GitAuthHelper { | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|         // Configure container includeIf
 |         // Configure container includeIf
 | ||||||
|         let relativeSubmoduleConfigDir = path.relative( |         let relativeSubmoduleGitDir = path.relative( | ||||||
|           githubWorkspace, |           githubWorkspace, | ||||||
|           submoduleConfigDir |           submoduleGitDir | ||||||
|         ) |         ) | ||||||
|         relativeSubmoduleConfigDir = relativeSubmoduleConfigDir.replace( |         relativeSubmoduleGitDir = relativeSubmoduleGitDir.replace(/\\/g, '/') // Use forward slashes, even on Windows
 | ||||||
|           /\\/g, |  | ||||||
|           '/' |  | ||||||
|         ) // Use forward slashes, even on Windows
 |  | ||||||
|         const containerSubmoduleGitDir = path.posix.join( |         const containerSubmoduleGitDir = path.posix.join( | ||||||
|           '/github/workspace', |           '/github/workspace', | ||||||
|           relativeSubmoduleConfigDir |           relativeSubmoduleGitDir | ||||||
|         ) |         ) | ||||||
|         await this.git.config( |         await this.git.config( | ||||||
|           `includeIf.gitdir:${containerSubmoduleGitDir}.path`, |           `includeIf.gitdir:${containerSubmoduleGitDir}.path`, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user