fix: matching all nested files with a directory name (#1197)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Tonye Jack
2023-05-29 10:12:36 -06:00
committed by GitHub
parent 58c7ce2add
commit cf4fe8759a
5 changed files with 65 additions and 23 deletions

38
dist/index.js generated vendored
View File

@@ -980,8 +980,8 @@ function run() {
});
core.debug(`All other changed files: ${allOtherChangedFiles}`);
const otherChangedFiles = allOtherChangedFiles
.split(inputs.filesSeparator)
.filter(filePath => !allChangedFiles.split(inputs.filesSeparator).includes(filePath));
.split(inputs.separator)
.filter(filePath => !allChangedFiles.split(inputs.separator).includes(filePath));
const onlyChanged = otherChangedFiles.length === 0 && allChangedFiles.length > 0;
yield (0, utils_1.setOutput)({
key: 'only_changed',
@@ -990,7 +990,7 @@ function run() {
});
yield (0, utils_1.setOutput)({
key: 'other_changed_files',
value: otherChangedFiles.join(inputs.filesSeparator),
value: otherChangedFiles.join(inputs.separator),
inputs
});
const allModifiedFiles = yield (0, changedFiles_1.getDiffFiles)({
@@ -1022,8 +1022,8 @@ function run() {
submodulePaths
});
const otherModifiedFiles = allOtherModifiedFiles
.split(inputs.filesSeparator)
.filter(filePath => !allModifiedFiles.split(inputs.filesSeparator).includes(filePath));
.split(inputs.separator)
.filter(filePath => !allModifiedFiles.split(inputs.separator).includes(filePath));
const onlyModified = otherModifiedFiles.length === 0 && allModifiedFiles.length > 0;
yield (0, utils_1.setOutput)({
key: 'only_modified',
@@ -1032,7 +1032,7 @@ function run() {
});
yield (0, utils_1.setOutput)({
key: 'other_modified_files',
value: otherModifiedFiles.join(inputs.filesSeparator),
value: otherModifiedFiles.join(inputs.separator),
inputs
});
const deletedFiles = yield (0, changedFiles_1.getDiffFiles)({
@@ -1064,8 +1064,8 @@ function run() {
submodulePaths
});
const otherDeletedFiles = allOtherDeletedFiles
.split(inputs.filesSeparator)
.filter(filePath => !deletedFiles.split(inputs.filesSeparator).includes(filePath));
.split(inputs.separator)
.filter(filePath => !deletedFiles.split(inputs.separator).includes(filePath));
const onlyDeleted = otherDeletedFiles.length === 0 && deletedFiles.length > 0;
yield (0, utils_1.setOutput)({
key: 'only_deleted',
@@ -1074,7 +1074,7 @@ function run() {
});
yield (0, utils_1.setOutput)({
key: 'other_deleted_files',
value: otherDeletedFiles.join(inputs.filesSeparator),
value: otherDeletedFiles.join(inputs.separator),
inputs
});
if (inputs.includeAllOldNewRenamedFiles) {
@@ -1660,7 +1660,25 @@ const getFilePatterns = ({ inputs, workingDirectory }) => __awaiter(void 0, void
filePatterns = filePatterns.replace(/\r/g, '\n');
}
core.debug(`file patterns: ${filePatterns}`);
return filePatterns.trim().split('\n').filter(Boolean);
return filePatterns
.trim()
.split('\n')
.filter(Boolean)
.map(pattern => {
if (pattern.endsWith('/')) {
return `${pattern}**`;
}
else {
const pathParts = pattern.split('/');
const lastPart = pathParts[pathParts.length - 1];
if (!lastPart.includes('.')) {
return `${pattern}/**`;
}
else {
return pattern;
}
}
});
});
exports.getFilePatterns = getFilePatterns;
const setOutput = ({ key, value, inputs }) => __awaiter(void 0, void 0, void 0, function* () {