mirror of
https://github.com/dorny/paths-filter.git
synced 2025-06-08 00:59:04 +00:00
Fix unnecessary calls to getLocalRef()
This commit is contained in:
parent
78b1672eeb
commit
e59743163d
2 changed files with 20 additions and 19 deletions
19
src/git.ts
19
src/git.ts
|
@ -163,7 +163,7 @@ export async function listAllFilesAsAdded(): Promise<File[]> {
|
|||
}
|
||||
|
||||
export async function getCurrentRef(): Promise<string> {
|
||||
core.startGroup(`Determining current ref`)
|
||||
core.startGroup(`Get current git ref`)
|
||||
try {
|
||||
const branch = (await exec('git', ['branch', '--show-current'])).stdout.trim()
|
||||
if (branch) {
|
||||
|
@ -236,15 +236,16 @@ async function ensureRefAvailable(name: string): Promise<string> {
|
|||
let ref = await getLocalRef(name)
|
||||
if (ref === undefined) {
|
||||
await exec('git', ['fetch', '--depth=1', '--no-tags', 'origin', name])
|
||||
ref = await getLocalRef(name)
|
||||
if (ref === undefined) {
|
||||
await exec('git', ['fetch', '--depth=1', '--tags', 'origin', name])
|
||||
ref = await getLocalRef(name)
|
||||
if (ref === undefined) {
|
||||
throw new Error(`Could not determine what is ${name} - fetch works but it's not a branch, tag or commit SHA`)
|
||||
}
|
||||
}
|
||||
}
|
||||
ref = await getLocalRef(name)
|
||||
if (ref === undefined) {
|
||||
await exec('git', ['fetch', '--depth=1', '--tags', 'origin', name])
|
||||
}
|
||||
ref = await getLocalRef(name)
|
||||
if (ref === undefined) {
|
||||
throw new Error(`Could not determine what is ${name} - fetch works but it's not a branch, tag or commit SHA`)
|
||||
}
|
||||
|
||||
return ref
|
||||
} finally {
|
||||
core.endGroup()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue