Skip to content

Commit

Permalink
remove: appending globstar pattern for directories to prevent bugs wi…
Browse files Browse the repository at this point in the history
…th path matching (#1670)

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
jackton1 and actions-user authored Oct 26, 2023
1 parent d898dd0 commit 3ce5a29
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 40 deletions.
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

0 comments on commit 3ce5a29

Please sign in to comment.