mirror of
https://github.com/actions/checkout.git
synced 2025-07-12 08:40:45 +00:00
added filter option & tests
This commit is contained in:
parent
96f53100ba
commit
99fc22de1f
7 changed files with 46 additions and 1 deletions
|
@ -154,7 +154,13 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
|||
// Fetch
|
||||
core.startGroup('Fetching the repository')
|
||||
const fetchOptions: {filter?: string; fetchDepth?: number} = {}
|
||||
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(
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -82,6 +82,10 @@ export async function getInputs(): Promise<IGitSourceSettings> {
|
|||
result.clean = (core.getInput('clean') || 'true').toUpperCase() === 'TRUE'
|
||||
core.debug(`clean = ${result.clean}`)
|
||||
|
||||
// Filter
|
||||
result.filter = core.getInput('filter')
|
||||
core.debug(`filter = ${result.filter}`)
|
||||
|
||||
// Sparse checkout
|
||||
const sparseCheckout = core.getMultilineInput('sparse-checkout')
|
||||
if (sparseCheckout.length) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue