mirror of
https://github.com/actions/checkout.git
synced 2024-12-23 09:07:44 +01:00
fix branch conditions
This commit is contained in:
parent
b0b939aaa5
commit
9dceaac6c6
@ -187,10 +187,10 @@ class GitCommandManager {
|
||||
}
|
||||
|
||||
args.push('--prune', '--progress', '--no-recurse-submodules')
|
||||
if (fetchDepth && fetchDepth > 0) {
|
||||
args.push(`--depth=${fetchDepth}`)
|
||||
} else if (shallowSince) {
|
||||
if (shallowSince) {
|
||||
args.push(`--shallow-since=${shallowSince}`)
|
||||
} else if (fetchDepth && fetchDepth > 0) {
|
||||
args.push(`--depth=${fetchDepth}`)
|
||||
} else if (
|
||||
fshelper.fileExistsSync(
|
||||
path.join(this.workingDirectory, '.git', 'shallow')
|
||||
|
@ -81,6 +81,12 @@ export function getInputs(): IGitSourceSettings {
|
||||
result.clean = (core.getInput('clean') || 'true').toUpperCase() === 'TRUE'
|
||||
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
|
||||
result.fetchDepth = Math.floor(Number(core.getInput('fetch-depth') || '1'))
|
||||
if (isNaN(result.fetchDepth) || result.fetchDepth < 0) {
|
||||
@ -92,12 +98,6 @@ export function getInputs(): IGitSourceSettings {
|
||||
result.shallowSince = core.getInput('shallow-since')
|
||||
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
|
||||
result.lfs = (core.getInput('lfs') || 'false').toUpperCase() === 'TRUE'
|
||||
core.debug(`lfs = ${result.lfs}`)
|
||||
|
Loading…
Reference in New Issue
Block a user