Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: overwriting yaml filter patterns #2307

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions dist/index.js
jackton1 marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

38 changes: 15 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,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) {
Expand All @@ -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
}
}
}

Expand Down
Loading