mirror of
				https://github.com/actions/checkout.git
				synced 2025-10-31 20:33:36 +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: '' |     clean: '' | ||||||
| 
 | 
 | ||||||
|     # Whether to preserve local changes during checkout. If true, tries to preserve |     # 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 |     # Default: false | ||||||
|     preserveLocalChanges: '' |     preserve-local-changes: '' | ||||||
| 
 | 
 | ||||||
|     # Partially clone against a given filter. Overrides sparse-checkout if set. |     # Partially clone against a given filter. Overrides sparse-checkout if set. | ||||||
|     # Default: null |     # Default: null | ||||||
| @ -349,7 +350,7 @@ steps: | |||||||
|     uses: actions/checkout@v5 |     uses: actions/checkout@v5 | ||||||
|     with: |     with: | ||||||
|       clean: false |       clean: false | ||||||
|       preserveLocalChanges: true |       preserve-local-changes: true | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| # Recommended permissions | # Recommended permissions | ||||||
|  | |||||||
| @ -57,7 +57,7 @@ inputs: | |||||||
|   clean: |   clean: | ||||||
|     description: 'Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching' |     description: 'Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching' | ||||||
|     default: 'true' |     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.' |     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' |     default: 'false' | ||||||
|   filter: |   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`); |             yield fs.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`); | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|     checkout(ref, startPoint) { |     checkout(ref_1, startPoint_1) { | ||||||
|         return __awaiter(this, void 0, void 0, function* () { |         return __awaiter(this, arguments, void 0, function* (ref, startPoint, options = []) { | ||||||
|             const args = ['checkout', '--progress', '--force']; |             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) { |             if (startPoint) { | ||||||
|                 args.push('-B', ref, startPoint); |                 args.push('-B', ref, startPoint); | ||||||
|             } |             } | ||||||
| @ -1329,7 +1337,16 @@ function getSource(settings) { | |||||||
|             } |             } | ||||||
|             // Checkout
 |             // Checkout
 | ||||||
|             core.startGroup('Checking out the ref'); |             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(); |             core.endGroup(); | ||||||
|             // Submodules
 |             // Submodules
 | ||||||
|             if (settings.submodules) { |             if (settings.submodules) { | ||||||
| @ -1766,6 +1783,9 @@ 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}`); | ||||||
|  |         // Preserve local changes
 | ||||||
|  |         result.preserveLocalChanges = (core.getInput('preserve-local-changes') || 'false').toUpperCase() === 'TRUE'; | ||||||
|  |         core.debug(`preserveLocalChanges = ${result.preserveLocalChanges}`); | ||||||
|         // Filter
 |         // Filter
 | ||||||
|         const filter = core.getInput('filter'); |         const filter = core.getInput('filter'); | ||||||
|         if (filter) { |         if (filter) { | ||||||
|  | |||||||
| @ -83,7 +83,7 @@ export async function getInputs(): Promise<IGitSourceSettings> { | |||||||
|   core.debug(`clean = ${result.clean}`) |   core.debug(`clean = ${result.clean}`) | ||||||
| 
 | 
 | ||||||
|   // Preserve local changes
 |   // 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}`) |   core.debug(`preserveLocalChanges = ${result.preserveLocalChanges}`) | ||||||
| 
 | 
 | ||||||
|   // Filter
 |   // Filter
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user