Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -553,7 +554,7 @@ See [outputs](#outputs) for a list of all available outputs.
*.sh
*.png
!*.md
test_directory
test_directory/**
**/*.sql
...
```
Expand All @@ -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
Expand Down
20 changes: 1 addition & 19 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.

18 changes: 1 addition & 17 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down