Skip to content

Commit

Permalink
fix: bug with order in which the files and files ignore patterns are …
Browse files Browse the repository at this point in the history
…combined (#1684)

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
jackton1 and actions-user authored Oct 30, 2023
1 parent 2fc653d commit 7549e1e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 36 deletions.
28 changes: 14 additions & 14 deletions dist/index.js

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.

46 changes: 25 additions & 21 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -938,27 +938,7 @@ export const getFilePatterns = async ({
inputs: Inputs
workingDirectory: string
}): Promise<string[]> => {
let filePatterns = 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)
}
let filePatterns = ''

if (inputs.filesIgnore) {
const filesIgnorePatterns = inputs.filesIgnore
Expand Down Expand Up @@ -1001,6 +981,30 @@ export const getFilePatterns = async ({
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()) {
filePatterns = filePatterns.replace(/\r\n/g, '\n')
filePatterns = filePatterns.replace(/\r/g, '\n')
Expand Down

0 comments on commit 7549e1e

Please sign in to comment.