mirror of
				https://github.com/actions/checkout.git
				synced 2025-10-31 12:23:35 +00:00 
			
		
		
		
	kebab case
This commit is contained in:
		
							parent
							
								
									45fe6460ed
								
							
						
					
					
						commit
						f04b821901
					
				| @ -97,9 +97,10 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/ | ||||
|     clean: '' | ||||
| 
 | ||||
|     # Whether to preserve local changes during checkout. If true, tries to preserve | ||||
|     # local files that are not tracked by Git. By default, all files will be overwritten. | ||||
|     # local files that are not tracked by Git. By default, all files will be | ||||
|     # overwritten. | ||||
|     # Default: false | ||||
|     preserveLocalChanges: '' | ||||
|     preserve-local-changes: '' | ||||
| 
 | ||||
|     # Partially clone against a given filter. Overrides sparse-checkout if set. | ||||
|     # Default: null | ||||
| @ -349,7 +350,7 @@ steps: | ||||
|     uses: actions/checkout@v5 | ||||
|     with: | ||||
|       clean: false | ||||
|       preserveLocalChanges: true | ||||
|       preserve-local-changes: true | ||||
| ``` | ||||
| 
 | ||||
| # Recommended permissions | ||||
|  | ||||
| @ -57,7 +57,7 @@ inputs: | ||||
|   clean: | ||||
|     description: 'Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching' | ||||
|     default: 'true' | ||||
|   preserveLocalChanges: | ||||
|   preserve-local-changes: | ||||
|     description: 'Whether to preserve local changes during checkout. If true, tries to preserve local files that are not tracked by Git. By default, all files will be overwritten.' | ||||
|     default: 'false' | ||||
|   filter: | ||||
|  | ||||
							
								
								
									
										28
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @ -609,9 +609,17 @@ class GitCommandManager { | ||||
|             yield fs.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`); | ||||
|         }); | ||||
|     } | ||||
|     checkout(ref, startPoint) { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             const args = ['checkout', '--progress', '--force']; | ||||
|     checkout(ref_1, startPoint_1) { | ||||
|         return __awaiter(this, arguments, void 0, function* (ref, startPoint, options = []) { | ||||
|             const args = ['checkout', '--progress']; | ||||
|             // Add custom options (like --merge) if provided
 | ||||
|             if (options.length > 0) { | ||||
|                 args.push(...options); | ||||
|             } | ||||
|             else { | ||||
|                 // Default behavior - use force
 | ||||
|                 args.push('--force'); | ||||
|             } | ||||
|             if (startPoint) { | ||||
|                 args.push('-B', ref, startPoint); | ||||
|             } | ||||
| @ -1329,7 +1337,16 @@ function getSource(settings) { | ||||
|             } | ||||
|             // Checkout
 | ||||
|             core.startGroup('Checking out the ref'); | ||||
|             yield git.checkout(checkoutInfo.ref, checkoutInfo.startPoint); | ||||
|             if (settings.preserveLocalChanges) { | ||||
|                 core.info('Attempting to preserve local changes during checkout'); | ||||
|                 // Use --merge to preserve local changes if possible
 | ||||
|                 // This will fail if there are merge conflicts, but that's expected behavior
 | ||||
|                 yield git.checkout(checkoutInfo.ref, checkoutInfo.startPoint, ['--merge']); | ||||
|             } | ||||
|             else { | ||||
|                 // Use the default behavior with --force
 | ||||
|                 yield git.checkout(checkoutInfo.ref, checkoutInfo.startPoint); | ||||
|             } | ||||
|             core.endGroup(); | ||||
|             // Submodules
 | ||||
|             if (settings.submodules) { | ||||
| @ -1766,6 +1783,9 @@ function getInputs() { | ||||
|         // Clean
 | ||||
|         result.clean = (core.getInput('clean') || 'true').toUpperCase() === 'TRUE'; | ||||
|         core.debug(`clean = ${result.clean}`); | ||||
|         // Preserve local changes
 | ||||
|         result.preserveLocalChanges = (core.getInput('preserve-local-changes') || 'false').toUpperCase() === 'TRUE'; | ||||
|         core.debug(`preserveLocalChanges = ${result.preserveLocalChanges}`); | ||||
|         // Filter
 | ||||
|         const filter = core.getInput('filter'); | ||||
|         if (filter) { | ||||
|  | ||||
| @ -83,7 +83,7 @@ export async function getInputs(): Promise<IGitSourceSettings> { | ||||
|   core.debug(`clean = ${result.clean}`) | ||||
| 
 | ||||
|   // Preserve local changes
 | ||||
|   result.preserveLocalChanges = (core.getInput('preserveLocalChanges') || 'false').toUpperCase() === 'TRUE' | ||||
|   result.preserveLocalChanges = (core.getInput('preserve-local-changes') || 'false').toUpperCase() === 'TRUE' | ||||
|   core.debug(`preserveLocalChanges = ${result.preserveLocalChanges}`) | ||||
| 
 | ||||
|   // Filter
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user