Add fetch.parallel option

This commit is contained in:
Gonzalo Peci 2023-12-14 15:22:00 +01:00
parent edc3278d02
commit 9efed57e86
7 changed files with 36 additions and 2 deletions

View file

@ -153,6 +153,7 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
// Fetch
core.startGroup('Fetching the repository')
await git.config('fetch.parallel', settings.fetchParallel.toString())
const fetchOptions: {
filter?: string
fetchDepth?: number

View file

@ -54,6 +54,11 @@ export interface IGitSourceSettings {
*/
fetchTags: boolean
/**
* Indicates the maximal number of fetch operations to be run in parallel at a time
*/
fetchParallel: number
/**
* Indicates whether to use the --progress option when fetching
*/

View file

@ -113,6 +113,15 @@ export async function getInputs(): Promise<IGitSourceSettings> {
(core.getInput('fetch-tags') || 'false').toUpperCase() === 'TRUE'
core.debug(`fetch tags = ${result.fetchTags}`)
// Fetch tags
result.fetchParallel = Math.floor(
Number(core.getInput('fetch-parallel') || '1')
)
if (isNaN(result.fetchParallel) || result.fetchParallel < 0) {
result.fetchParallel = 0
}
core.debug(`fetch parallel = ${result.fetchTags}`)
// Show fetch progress
result.showProgress =
(core.getInput('show-progress') || 'true').toUpperCase() === 'TRUE'