0
1
Fork 0
mirror of https://github.com/actions/checkout synced 2024-06-28 16:18:20 +02:00

Convert fetchJobs to number type

This commit is contained in:
Gonzalo Peci 2023-12-14 15:24:16 +01:00
parent 9efed57e86
commit 0b6a67545b
4 changed files with 22 additions and 7 deletions

11
dist/index.js vendored
View file

@ -1305,7 +1305,7 @@ function getSource(settings) {
core.endGroup(); core.endGroup();
// Checkout submodules // Checkout submodules
core.startGroup('Fetching submodules'); core.startGroup('Fetching submodules');
yield git.config('submodule.fetchJobs', settings.submodulesFetchJobs); yield git.config('submodule.fetchJobs', settings.submodulesFetchJobs.toString());
yield git.submoduleSync(settings.nestedSubmodules); yield git.submoduleSync(settings.nestedSubmodules);
yield git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules); yield git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules);
yield git.submoduleForeach('git config --local gc.auto 0', settings.nestedSubmodules); yield git.submoduleForeach('git config --local gc.auto 0', settings.nestedSubmodules);
@ -1778,12 +1778,17 @@ function getInputs() {
else if (submodulesString == 'TRUE') { else if (submodulesString == 'TRUE') {
result.submodules = true; result.submodules = true;
} }
result.submodulesFetchJobs = core.getInput('submodulesFetchJobs') || '1'; result.submodulesFetchJobs = Math.floor(Number(core.getInput('submodulesFetchJobs') || '1'));
if (isNaN(result.submodulesFetchJobs) || result.submodulesFetchJobs < 0) {
result.submodulesFetchJobs = 0;
}
core.debug(`submodules = ${result.submodules}`); core.debug(`submodules = ${result.submodules}`);
core.debug(`recursive submodules = ${result.nestedSubmodules}`); core.debug(`recursive submodules = ${result.nestedSubmodules}`);
core.debug(`submodules fetchJobs= ${result.submodulesFetchJobs}`); core.debug(`submodules fetchJobs= ${result.submodulesFetchJobs}`);
// Auth token // Auth token
result.authToken = core.getInput('token', { required: true }); result.authToken = core.getInput('token', {
required: true
});
// SSH // SSH
result.sshKey = core.getInput('ssh-key'); result.sshKey = core.getInput('ssh-key');
result.sshKnownHosts = core.getInput('ssh-known-hosts'); result.sshKnownHosts = core.getInput('ssh-known-hosts');

View file

@ -233,7 +233,10 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
// Checkout submodules // Checkout submodules
core.startGroup('Fetching submodules') core.startGroup('Fetching submodules')
await git.config('submodule.fetchJobs', settings.submodulesFetchJobs) await git.config(
'submodule.fetchJobs',
settings.submodulesFetchJobs.toString()
)
await git.submoduleSync(settings.nestedSubmodules) await git.submoduleSync(settings.nestedSubmodules)
await git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules) await git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules)
await git.submoduleForeach( await git.submoduleForeach(

View file

@ -82,7 +82,7 @@ export interface IGitSourceSettings {
/** /**
* Indicates the number of parallel jobs to use when fetching submodules * Indicates the number of parallel jobs to use when fetching submodules
*/ */
submodulesFetchJobs: string submodulesFetchJobs: number
/** /**
* The auth token to use when fetching the repository * The auth token to use when fetching the repository

View file

@ -141,13 +141,20 @@ export async function getInputs(): Promise<IGitSourceSettings> {
} else if (submodulesString == 'TRUE') { } else if (submodulesString == 'TRUE') {
result.submodules = true result.submodules = true
} }
result.submodulesFetchJobs = core.getInput('submodulesFetchJobs') || '1' result.submodulesFetchJobs = Math.floor(
Number(core.getInput('submodulesFetchJobs') || '1')
)
if (isNaN(result.submodulesFetchJobs) || result.submodulesFetchJobs < 0) {
result.submodulesFetchJobs = 0
}
core.debug(`submodules = ${result.submodules}`) core.debug(`submodules = ${result.submodules}`)
core.debug(`recursive submodules = ${result.nestedSubmodules}`) core.debug(`recursive submodules = ${result.nestedSubmodules}`)
core.debug(`submodules fetchJobs= ${result.submodulesFetchJobs}`) core.debug(`submodules fetchJobs= ${result.submodulesFetchJobs}`)
// Auth token // Auth token
result.authToken = core.getInput('token', {required: true}) result.authToken = core.getInput('token', {
required: true
})
// SSH // SSH
result.sshKey = core.getInput('ssh-key') result.sshKey = core.getInput('ssh-key')