mirror of
				https://github.com/actions/checkout.git
				synced 2025-10-31 02:53:36 +00:00 
			
		
		
		
	feat: updated dist with build
This commit is contained in:
		
							parent
							
								
									9f6bfbc6bc
								
							
						
					
					
						commit
						5bd25a5859
					
				
							
								
								
									
										40
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										40
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @ -574,6 +574,11 @@ class GitCommandManager { | |||||||
|             return result; |             return result; | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |     sparseCheckout(sparseCheckout) { | ||||||
|  |         return __awaiter(this, void 0, void 0, function* () { | ||||||
|  |             yield this.execGit(['sparse-checkout', 'set', ...sparseCheckout]); | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|     checkout(ref, startPoint) { |     checkout(ref, startPoint) { | ||||||
|         return __awaiter(this, void 0, void 0, function* () { |         return __awaiter(this, void 0, void 0, function* () { | ||||||
|             const args = ['checkout', '--progress', '--force']; |             const args = ['checkout', '--progress', '--force']; | ||||||
| @ -615,15 +620,18 @@ class GitCommandManager { | |||||||
|             return output.exitCode === 0; |             return output.exitCode === 0; | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|     fetch(refSpec, fetchDepth) { |     fetch(refSpec, options) { | ||||||
|         return __awaiter(this, void 0, void 0, function* () { |         return __awaiter(this, void 0, void 0, function* () { | ||||||
|             const args = ['-c', 'protocol.version=2', 'fetch']; |             const args = ['-c', 'protocol.version=2', 'fetch']; | ||||||
|             if (!refSpec.some(x => x === refHelper.tagsRefSpec)) { |             if (!refSpec.some(x => x === refHelper.tagsRefSpec)) { | ||||||
|                 args.push('--no-tags'); |                 args.push('--no-tags'); | ||||||
|             } |             } | ||||||
|             args.push('--prune', '--progress', '--no-recurse-submodules'); |             args.push('--prune', '--progress', '--no-recurse-submodules'); | ||||||
|             if (fetchDepth && fetchDepth > 0) { |             if (options.filter) { | ||||||
|                 args.push(`--depth=${fetchDepth}`); |                 args.push(`--filter=${options.filter}`); | ||||||
|  |             } | ||||||
|  |             if (options.fetchDepth && options.fetchDepth > 0) { | ||||||
|  |                 args.push(`--depth=${options.fetchDepth}`); | ||||||
|             } |             } | ||||||
|             else if (fshelper.fileExistsSync(path.join(this.workingDirectory, '.git', 'shallow'))) { |             else if (fshelper.fileExistsSync(path.join(this.workingDirectory, '.git', 'shallow'))) { | ||||||
|                 args.push('--unshallow'); |                 args.push('--unshallow'); | ||||||
| @ -696,8 +704,8 @@ class GitCommandManager { | |||||||
|     } |     } | ||||||
|     log1(format) { |     log1(format) { | ||||||
|         return __awaiter(this, void 0, void 0, function* () { |         return __awaiter(this, void 0, void 0, function* () { | ||||||
|             var args = format ? ['log', '-1', format] : ['log', '-1']; |             const args = format ? ['log', '-1', format] : ['log', '-1']; | ||||||
|             var silent = format ? false : true; |             const silent = format ? false : true; | ||||||
|             const output = yield this.execGit(args, false, silent); |             const output = yield this.execGit(args, false, silent); | ||||||
|             return output.stdout; |             return output.stdout; | ||||||
|         }); |         }); | ||||||
| @ -1210,20 +1218,24 @@ function getSource(settings) { | |||||||
|             } |             } | ||||||
|             // Fetch
 |             // Fetch
 | ||||||
|             core.startGroup('Fetching the repository'); |             core.startGroup('Fetching the repository'); | ||||||
|  |             const fetchOptions = {}; | ||||||
|  |             if (settings.sparseCheckout) | ||||||
|  |                 fetchOptions.filter = 'blob:none'; | ||||||
|             if (settings.fetchDepth <= 0) { |             if (settings.fetchDepth <= 0) { | ||||||
|                 // Fetch all branches and tags
 |                 // Fetch all branches and tags
 | ||||||
|                 let refSpec = refHelper.getRefSpecForAllHistory(settings.ref, settings.commit); |                 let refSpec = refHelper.getRefSpecForAllHistory(settings.ref, settings.commit); | ||||||
|                 yield git.fetch(refSpec); |                 yield git.fetch(refSpec, fetchOptions); | ||||||
|                 // When all history is fetched, the ref we're interested in may have moved to a different
 |                 // When all history is fetched, the ref we're interested in may have moved to a different
 | ||||||
|                 // commit (push or force push). If so, fetch again with a targeted refspec.
 |                 // commit (push or force push). If so, fetch again with a targeted refspec.
 | ||||||
|                 if (!(yield refHelper.testRef(git, settings.ref, settings.commit))) { |                 if (!(yield refHelper.testRef(git, settings.ref, settings.commit))) { | ||||||
|                     refSpec = refHelper.getRefSpec(settings.ref, settings.commit); |                     refSpec = refHelper.getRefSpec(settings.ref, settings.commit); | ||||||
|                     yield git.fetch(refSpec); |                     yield git.fetch(refSpec, fetchOptions); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|  |                 fetchOptions.fetchDepth = settings.fetchDepth; | ||||||
|                 const refSpec = refHelper.getRefSpec(settings.ref, settings.commit); |                 const refSpec = refHelper.getRefSpec(settings.ref, settings.commit); | ||||||
|                 yield git.fetch(refSpec, settings.fetchDepth); |                 yield git.fetch(refSpec, fetchOptions); | ||||||
|             } |             } | ||||||
|             core.endGroup(); |             core.endGroup(); | ||||||
|             // Checkout info
 |             // Checkout info
 | ||||||
| @ -1238,6 +1250,12 @@ function getSource(settings) { | |||||||
|                 yield git.lfsFetch(checkoutInfo.startPoint || checkoutInfo.ref); |                 yield git.lfsFetch(checkoutInfo.startPoint || checkoutInfo.ref); | ||||||
|                 core.endGroup(); |                 core.endGroup(); | ||||||
|             } |             } | ||||||
|  |             // Sparse checkout
 | ||||||
|  |             if (settings.sparseCheckout) { | ||||||
|  |                 core.startGroup('Setting up sparse checkout'); | ||||||
|  |                 yield git.sparseCheckout(settings.sparseCheckout); | ||||||
|  |                 core.endGroup(); | ||||||
|  |             } | ||||||
|             // Checkout
 |             // Checkout
 | ||||||
|             core.startGroup('Checking out the ref'); |             core.startGroup('Checking out the ref'); | ||||||
|             yield git.checkout(checkoutInfo.ref, checkoutInfo.startPoint); |             yield git.checkout(checkoutInfo.ref, checkoutInfo.startPoint); | ||||||
| @ -1673,6 +1691,12 @@ function getInputs() { | |||||||
|         // Clean
 |         // Clean
 | ||||||
|         result.clean = (core.getInput('clean') || 'true').toUpperCase() === 'TRUE'; |         result.clean = (core.getInput('clean') || 'true').toUpperCase() === 'TRUE'; | ||||||
|         core.debug(`clean = ${result.clean}`); |         core.debug(`clean = ${result.clean}`); | ||||||
|  |         // Sparse checkout
 | ||||||
|  |         const sparseCheckout = core.getMultilineInput('sparse-checkout'); | ||||||
|  |         if (sparseCheckout.length) { | ||||||
|  |             result.sparseCheckout = sparseCheckout; | ||||||
|  |             core.debug(`sparse checkout = ${result.sparseCheckout}`); | ||||||
|  |         } | ||||||
|         // Fetch depth
 |         // Fetch depth
 | ||||||
|         result.fetchDepth = Math.floor(Number(core.getInput('fetch-depth') || '1')); |         result.fetchDepth = Math.floor(Number(core.getInput('fetch-depth') || '1')); | ||||||
|         if (isNaN(result.fetchDepth) || result.fetchDepth < 0) { |         if (isNaN(result.fetchDepth) || result.fetchDepth < 0) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user