fix: overwriting yaml filter patterns (#2307)

Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Tonye Jack 2024-10-03 06:48:13 -06:00 committed by GitHub
parent 27843f1667
commit c3a1bb2c99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 23 deletions

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

View File

@ -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
}
}
}
@ -1279,15 +1274,14 @@ 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) {
@ -1309,16 +1303,14 @@ 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
}
}
}