feat: add dir_names_exclude_current_dir input and cleaned up logic to retrieve the current sha (#1229)

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
This commit is contained in:
Tonye Jack
2023-06-06 06:00:56 -06:00
committed by GitHub
parent cdf9afcec8
commit 353ea22e6f
7 changed files with 59 additions and 25 deletions

View File

@@ -642,11 +642,11 @@ export const canDiffCommits = async ({
export const getDirnameMaxDepth = ({
pathStr,
dirNamesMaxDepth,
excludeRoot
excludeCurrentDir
}: {
pathStr: string
dirNamesMaxDepth?: number
excludeRoot?: boolean
excludeCurrentDir?: boolean
}): string => {
const pathArr = dirname(pathStr).split(path.sep)
const maxDepth = Math.min(dirNamesMaxDepth || pathArr.length, pathArr.length)
@@ -656,7 +656,7 @@ export const getDirnameMaxDepth = ({
output = path.join(output, pathArr[i])
}
if (excludeRoot && output === '.') {
if (excludeCurrentDir && output === '.') {
return ''
}