mirror of
https://github.com/tj-actions/changed-files
synced 2025-02-22 01:17:40 +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:
parent
d898dd09e4
commit
3ce5a2970f
4 changed files with 7 additions and 40 deletions
|
@ -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.
|
> * 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.
|
> * 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).
|
> * 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.
|
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
|
id: changed-files-specific
|
||||||
uses: tj-actions/changed-files@v39
|
uses: tj-actions/changed-files@v39
|
||||||
with:
|
with:
|
||||||
files: docs/*.{js,html} # Alternatively using: `docs/**` or `docs`
|
files: docs/*.{js,html} # Alternatively using: `docs/**`
|
||||||
files_ignore: docs/static.js
|
files_ignore: docs/static.js
|
||||||
|
|
||||||
- name: Run step if any file(s) in the docs folder change
|
- 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
|
*.sh
|
||||||
*.png
|
*.png
|
||||||
!*.md
|
!*.md
|
||||||
test_directory
|
test_directory/**
|
||||||
**/*.sql
|
**/*.sql
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
@ -576,7 +577,7 @@ See [inputs](#inputs) for more information.
|
||||||
*.sh
|
*.sh
|
||||||
*.png
|
*.png
|
||||||
!*.md
|
!*.md
|
||||||
test_directory
|
test_directory/**
|
||||||
**/*.sql
|
**/*.sql
|
||||||
|
|
||||||
- name: Run step if any of the listed files above change
|
- name: Run step if any of the listed files above change
|
||||||
|
|
20
dist/index.js
generated
vendored
20
dist/index.js
generated
vendored
|
@ -2588,25 +2588,7 @@ const getFilePatterns = ({ inputs, workingDirectory }) => __awaiter(void 0, void
|
||||||
filePatterns = filePatterns.replace(/\r/g, '\n');
|
filePatterns = filePatterns.replace(/\r/g, '\n');
|
||||||
}
|
}
|
||||||
core.debug(`Input file patterns: ${filePatterns}`);
|
core.debug(`Input file patterns: ${filePatterns}`);
|
||||||
return filePatterns
|
return filePatterns.trim().split('\n').filter(Boolean);
|
||||||
.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
exports.getFilePatterns = getFilePatterns;
|
exports.getFilePatterns = getFilePatterns;
|
||||||
const getYamlFilePatternsFromContents = ({ content = '', filePath = '', excludedFiles = false }) => __awaiter(void 0, void 0, void 0, function* () {
|
const getYamlFilePatternsFromContents = ({ content = '', filePath = '', excludedFiles = false }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
18
src/utils.ts
18
src/utils.ts
|
@ -1008,23 +1008,7 @@ export const getFilePatterns = async ({
|
||||||
|
|
||||||
core.debug(`Input file patterns: ${filePatterns}`)
|
core.debug(`Input file patterns: ${filePatterns}`)
|
||||||
|
|
||||||
return filePatterns
|
return filePatterns.trim().split('\n').filter(Boolean)
|
||||||
.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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example YAML input:
|
// Example YAML input:
|
||||||
|
|
Loading…
Add table
Reference in a new issue