1
0
Fork 0
mirror of https://github.com/actions/checkout.git synced 2025-07-07 20:22:54 +00:00

Merge branch 'actions:main' into add-ssh-fetch-with-custome-port

This commit is contained in:
Jakob 2024-01-08 11:34:08 +01:00 committed by GitHub
commit 183b9f399c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 79 additions and 12 deletions

View file

@ -159,7 +159,13 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
fetchTags?: boolean
showProgress?: boolean
} = {}
if (settings.sparseCheckout) fetchOptions.filter = 'blob:none'
if (settings.filter) {
fetchOptions.filter = settings.filter
} else if (settings.sparseCheckout) {
fetchOptions.filter = 'blob:none'
}
if (settings.fetchDepth <= 0) {
// Fetch all branches and tags
let refSpec = refHelper.getRefSpecForAllHistory(

View file

@ -29,6 +29,11 @@ export interface IGitSourceSettings {
*/
clean: boolean
/**
* The filter determining which objects to include
*/
filter: string | undefined
/**
* The array of folders to make the sparse checkout
*/

View file

@ -82,6 +82,14 @@ export async function getInputs(): Promise<IGitSourceSettings> {
result.clean = (core.getInput('clean') || 'true').toUpperCase() === 'TRUE'
core.debug(`clean = ${result.clean}`)
// Filter
const filter = core.getInput('filter')
if (filter) {
result.filter = filter
}
core.debug(`filter = ${result.filter}`)
// Sparse checkout
const sparseCheckout = core.getMultilineInput('sparse-checkout')
if (sparseCheckout.length) {