Skip to content

Commit

Permalink
fix: order of file patterns (#1688)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
jackton1 and actions-user committed Oct 31, 2023
1 parent a59bf8f commit 4052680
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
11 changes: 9 additions & 2 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.

13 changes: 11 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4052680

Please sign in to comment.