3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-02-21 05:28:14 +00:00

fix: order of file patterns (#1688)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Tonye Jack 2023-10-31 12:39:35 -06:00 committed by GitHub
parent a59bf8ffcf
commit 40526807ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 5 deletions

11
dist/index.js generated vendored
View file

@ -2587,8 +2587,15 @@ const getFilePatterns = ({ inputs, workingDirectory }) => __awaiter(void 0, void
filePatterns = filePatterns.replace(/\r\n/g, '\n');
filePatterns = filePatterns.replace(/\r/g, '\n');
}
core.debug(`Input file patterns: ${filePatterns}`);
return filePatterns.trim().split('\n').filter(Boolean);
const filePatternsArray = filePatterns.trim().split('\n').filter(Boolean);
// Reorder file patterns '**' should come before '!**/*.txt' and then the rest 'dir/**/*.txt'
if (filePatternsArray.includes('**')) {
filePatternsArray.sort((a, b) => {
return a === '**' ? -1 : b === '**' ? 1 : 0;
});
}
core.debug(`Input file patterns: \n${filePatternsArray.join('\n')}`);
return filePatternsArray;
});
exports.getFilePatterns = getFilePatterns;
const getYamlFilePatternsFromContents = ({ content = '', filePath = '', excludedFiles = false }) => __awaiter(void 0, void 0, void 0, function* () {

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -1010,9 +1010,18 @@ export const getFilePatterns = async ({
filePatterns = filePatterns.replace(/\r/g, '\n')
}
core.debug(`Input file patterns: ${filePatterns}`)
const filePatternsArray = filePatterns.trim().split('\n').filter(Boolean)
return filePatterns.trim().split('\n').filter(Boolean)
// Reorder file patterns '**' should come before '!**/*.txt' and then the rest 'dir/**/*.txt'
if (filePatternsArray.includes('**')) {
filePatternsArray.sort((a, b) => {
return a === '**' ? -1 : b === '**' ? 1 : 0
})
}
core.debug(`Input file patterns: \n${filePatternsArray.join('\n')}`)
return filePatternsArray
}
// Example YAML input: