Skip to content

Commit 4052680

Browse files
fix: order of file patterns (#1688)
Co-authored-by: GitHub Action <[email protected]>
1 parent a59bf8f commit 4052680

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

dist/index.js

+9-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -1010,9 +1010,18 @@ export const getFilePatterns = async ({
10101010
filePatterns = filePatterns.replace(/\r/g, '\n')
10111011
}
10121012

1013-
core.debug(`Input file patterns: ${filePatterns}`)
1013+
const filePatternsArray = filePatterns.trim().split('\n').filter(Boolean)
10141014

1015-
return filePatterns.trim().split('\n').filter(Boolean)
1015+
// Reorder file patterns '**' should come before '!**/*.txt' and then the rest 'dir/**/*.txt'
1016+
if (filePatternsArray.includes('**')) {
1017+
filePatternsArray.sort((a, b) => {
1018+
return a === '**' ? -1 : b === '**' ? 1 : 0
1019+
})
1020+
}
1021+
1022+
core.debug(`Input file patterns: \n${filePatternsArray.join('\n')}`)
1023+
1024+
return filePatternsArray
10161025
}
10171026

10181027
// Example YAML input:

0 commit comments

Comments
 (0)