mirror of
https://gitea.com/actions/checkout.git
synced 2024-11-23 00:55:57 +01:00
fix branch conditions
This commit is contained in:
parent
b0b939aaa5
commit
9dceaac6c6
2 changed files with 9 additions and 9 deletions
|
@ -187,10 +187,10 @@ class GitCommandManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
args.push('--prune', '--progress', '--no-recurse-submodules')
|
args.push('--prune', '--progress', '--no-recurse-submodules')
|
||||||
if (fetchDepth && fetchDepth > 0) {
|
if (shallowSince) {
|
||||||
args.push(`--depth=${fetchDepth}`)
|
|
||||||
} else if (shallowSince) {
|
|
||||||
args.push(`--shallow-since=${shallowSince}`)
|
args.push(`--shallow-since=${shallowSince}`)
|
||||||
|
} else if (fetchDepth && fetchDepth > 0) {
|
||||||
|
args.push(`--depth=${fetchDepth}`)
|
||||||
} else if (
|
} else if (
|
||||||
fshelper.fileExistsSync(
|
fshelper.fileExistsSync(
|
||||||
path.join(this.workingDirectory, '.git', 'shallow')
|
path.join(this.workingDirectory, '.git', 'shallow')
|
||||||
|
|
|
@ -81,6 +81,12 @@ export function getInputs(): IGitSourceSettings {
|
||||||
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}`)
|
||||||
|
|
||||||
|
if (core.getInput('fetch-depth') && core.getInput('shallow-since')) {
|
||||||
|
throw new Error(
|
||||||
|
'`fetch-depth` and `shallow-since` cannot be used at the same time'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch depth
|
// Fetch depth
|
||||||
result.fetchDepth = Math.floor(Number(core.getInput('fetch-depth') || '1'))
|
result.fetchDepth = Math.floor(Number(core.getInput('fetch-depth') || '1'))
|
||||||
if (isNaN(result.fetchDepth) || result.fetchDepth < 0) {
|
if (isNaN(result.fetchDepth) || result.fetchDepth < 0) {
|
||||||
|
@ -92,12 +98,6 @@ export function getInputs(): IGitSourceSettings {
|
||||||
result.shallowSince = core.getInput('shallow-since')
|
result.shallowSince = core.getInput('shallow-since')
|
||||||
core.debug(`shallow since = ${result.shallowSince}`)
|
core.debug(`shallow since = ${result.shallowSince}`)
|
||||||
|
|
||||||
if (result.fetchDepth > 0 && result.shallowSince) {
|
|
||||||
throw new Error(
|
|
||||||
'`fetch-depath` and `shallow-since` cannot be used at the same time'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// LFS
|
// LFS
|
||||||
result.lfs = (core.getInput('lfs') || 'false').toUpperCase() === 'TRUE'
|
result.lfs = (core.getInput('lfs') || 'false').toUpperCase() === 'TRUE'
|
||||||
core.debug(`lfs = ${result.lfs}`)
|
core.debug(`lfs = ${result.lfs}`)
|
||||||
|
|
Loading…
Reference in a new issue