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

remove: appending globstar pattern for directories to prevent bugs with path matching (#1670)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Tonye Jack 2023-10-25 21:35:54 -06:00 committed by GitHub
parent d898dd09e4
commit 3ce5a2970f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 40 deletions

View file

@ -88,6 +88,7 @@ And many more...
> * For mono repositories where pulling all branch history might not be desired, you can still use the default [`fetch-depth`](https://github.com/actions/checkout#usage), which is set to `1` for `pull_request` events.
> * Avoid using single or double quotes for multiline inputs, as the value is already a string separated by a newline character. See [Examples](#examples) for more information.
> * If [`fetch-depth`](https://github.com/actions/checkout#usage) isn't set to `0`, ensure that [`persist-credentials`](https://github.com/actions/checkout#usage) is set to `true` when configuring [`actions/checkout`](https://github.com/actions/checkout#usage).
> * For matching all files and folders under a directory you'll need to use `dir_name/**`
Visit the [discussions for more information](https://github.com/tj-actions/changed-files/discussions) or [create a new discussion](https://github.com/tj-actions/changed-files/discussions/new/choose) for usage-related questions.
@ -167,7 +168,7 @@ jobs:
id: changed-files-specific
uses: tj-actions/changed-files@v39
with:
files: docs/*.{js,html} # Alternatively using: `docs/**` or `docs`
files: docs/*.{js,html} # Alternatively using: `docs/**`
files_ignore: docs/static.js
- name: Run step if any file(s) in the docs folder change
@ -553,7 +554,7 @@ See [outputs](#outputs) for a list of all available outputs.
*.sh
*.png
!*.md
test_directory
test_directory/**
**/*.sql
...
```
@ -576,7 +577,7 @@ See [inputs](#inputs) for more information.
*.sh
*.png
!*.md
test_directory
test_directory/**
**/*.sql
- name: Run step if any of the listed files above change

20
dist/index.js generated vendored
View file

@ -2588,25 +2588,7 @@ const getFilePatterns = ({ inputs, workingDirectory }) => __awaiter(void 0, void
filePatterns = filePatterns.replace(/\r/g, '\n');
}
core.debug(`Input file patterns: ${filePatterns}`);
return filePatterns
.trim()
.split('\n')
.filter(Boolean)
.map(pattern => {
if (pattern.endsWith('/')) {
return `${pattern}**`;
}
else {
const pathParts = pattern.split('/');
const lastPart = pathParts[pathParts.length - 1];
if (!lastPart.includes('.') && !lastPart.endsWith('*')) {
return `${pattern}/**`;
}
else {
return pattern;
}
}
});
return filePatterns.trim().split('\n').filter(Boolean);
});
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

@ -1008,23 +1008,7 @@ export const getFilePatterns = async ({
core.debug(`Input file patterns: ${filePatterns}`)
return filePatterns
.trim()
.split('\n')
.filter(Boolean)
.map(pattern => {
if (pattern.endsWith('/')) {
return `${pattern}**`
} else {
const pathParts = pattern.split('/')
const lastPart = pathParts[pathParts.length - 1]
if (!lastPart.includes('.') && !lastPart.endsWith('*')) {
return `${pattern}/**`
} else {
return pattern
}
}
})
return filePatterns.trim().split('\n').filter(Boolean)
}
// Example YAML input: