Skip to content

Commit

Permalink
fix: overwriting yaml filter patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 authored Oct 3, 2024
1 parent 27843f1 commit 6a74d2a
Showing 1 changed file with 9 additions and 23 deletions.
32 changes: 9 additions & 23 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1258,16 +1258,11 @@ export const getYamlFilePatterns = async ({
const newFilePatterns = await getYamlFilePatternsFromContents({filePath})
for (const key in newFilePatterns) {
if (key in filePatterns) {
core.warning(
`files_yaml_from_source_file: Duplicated key ${key} detected in ${filePath}, the ${filePatterns[key]} will be overwritten by ${newFilePatterns[key]}.`
)
filePatterns[key] = [...filePatterns[key], ...newFilePatterns[key]]
} else {
filePatterns[key] = newFilePatterns[key]
}
}

filePatterns = {
...filePatterns,
...newFilePatterns
}
}
}

Expand All @@ -1279,15 +1274,11 @@ export const getYamlFilePatterns = async ({

for (const key in newIgnoreFilePatterns) {
if (key in filePatterns) {
core.warning(
`files_ignore_yaml: Duplicated key ${key} detected, the ${filePatterns[key]} will be overwritten by ${newIgnoreFilePatterns[key]}.`
)
filePatterns[key] = [...filePatterns[key], ...newIgnoreFilePatterns[key]]
} else {
filePatterns[key] = newIgnoreFilePatterns[key]
}
}
filePatterns = {
...filePatterns,
...newIgnoreFilePatterns
}
}

if (inputs.filesIgnoreYamlFromSourceFile) {
Expand All @@ -1309,16 +1300,11 @@ export const getYamlFilePatterns = async ({

for (const key in newIgnoreFilePatterns) {
if (key in filePatterns) {
core.warning(
`files_ignore_yaml_from_source_file: Duplicated key ${key} detected in ${filePath}, the ${filePatterns[key]} will be overwritten by ${newIgnoreFilePatterns[key]}.`
)
filePatterns[key] = [...filePatterns[key], ...newIgnoreFilePatterns[key]]
} else {
filePatterns[key] = newIgnoreFilePatterns[key]
}
}

filePatterns = {
...filePatterns,
...newIgnoreFilePatterns
}
}
}

Expand Down

0 comments on commit 6a74d2a

Please sign in to comment.