mirror of
https://github.com/tj-actions/changed-files
synced 2025-01-29 13:34:51 +00:00
fix: bug with order in which the files and files ignore patterns are combined (#1684)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
2fc653d87d
commit
7549e1e4b9
3 changed files with 25 additions and 21 deletions
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
46
src/utils.ts
46
src/utils.ts
|
@ -938,27 +938,7 @@ export const getFilePatterns = async ({
|
||||||
inputs: Inputs
|
inputs: Inputs
|
||||||
workingDirectory: string
|
workingDirectory: string
|
||||||
}): Promise<string[]> => {
|
}): Promise<string[]> => {
|
||||||
let filePatterns = inputs.files
|
let filePatterns = ''
|
||||||
.split(inputs.filesSeparator)
|
|
||||||
.filter(Boolean)
|
|
||||||
.join('\n')
|
|
||||||
|
|
||||||
if (inputs.filesFromSourceFile !== '') {
|
|
||||||
const inputFilesFromSourceFile = inputs.filesFromSourceFile
|
|
||||||
.split(inputs.filesFromSourceFileSeparator)
|
|
||||||
.filter(p => p !== '')
|
|
||||||
.map(p => path.join(workingDirectory, p))
|
|
||||||
|
|
||||||
core.debug(`files from source file: ${inputFilesFromSourceFile}`)
|
|
||||||
|
|
||||||
const filesFromSourceFiles = (
|
|
||||||
await getFilesFromSourceFile({filePaths: inputFilesFromSourceFile})
|
|
||||||
).join('\n')
|
|
||||||
|
|
||||||
core.debug(`files from source files patterns: ${filesFromSourceFiles}`)
|
|
||||||
|
|
||||||
filePatterns = filePatterns.concat('\n', filesFromSourceFiles)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inputs.filesIgnore) {
|
if (inputs.filesIgnore) {
|
||||||
const filesIgnorePatterns = inputs.filesIgnore
|
const filesIgnorePatterns = inputs.filesIgnore
|
||||||
|
@ -1001,6 +981,30 @@ export const getFilePatterns = async ({
|
||||||
filePatterns = filePatterns.concat('\n', filesIgnoreFromSourceFiles)
|
filePatterns = filePatterns.concat('\n', filesIgnoreFromSourceFiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inputs.files) {
|
||||||
|
filePatterns = filePatterns.concat(
|
||||||
|
'\n',
|
||||||
|
inputs.files.split(inputs.filesSeparator).filter(Boolean).join('\n')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inputs.filesFromSourceFile !== '') {
|
||||||
|
const inputFilesFromSourceFile = inputs.filesFromSourceFile
|
||||||
|
.split(inputs.filesFromSourceFileSeparator)
|
||||||
|
.filter(p => p !== '')
|
||||||
|
.map(p => path.join(workingDirectory, p))
|
||||||
|
|
||||||
|
core.debug(`files from source file: ${inputFilesFromSourceFile}`)
|
||||||
|
|
||||||
|
const filesFromSourceFiles = (
|
||||||
|
await getFilesFromSourceFile({filePaths: inputFilesFromSourceFile})
|
||||||
|
).join('\n')
|
||||||
|
|
||||||
|
core.debug(`files from source files patterns: ${filesFromSourceFiles}`)
|
||||||
|
|
||||||
|
filePatterns = filePatterns.concat('\n', filesFromSourceFiles)
|
||||||
|
}
|
||||||
|
|
||||||
if (isWindows()) {
|
if (isWindows()) {
|
||||||
filePatterns = filePatterns.replace(/\r\n/g, '\n')
|
filePatterns = filePatterns.replace(/\r\n/g, '\n')
|
||||||
filePatterns = filePatterns.replace(/\r/g, '\n')
|
filePatterns = filePatterns.replace(/\r/g, '\n')
|
||||||
|
|
Loading…
Reference in a new issue