fix branch conditions

This commit is contained in:
satotake 2021-10-21 00:18:19 +09:00
parent b0b939aaa5
commit 9dceaac6c6
2 changed files with 9 additions and 9 deletions

View File

@ -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')

View File

@ -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}`)