You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37-20Lines changed: 37 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,24 @@
1
1
# Paths Changes Filter
2
2
3
-
[Github Action](https://github.com/features/actions) that enables conditional execution of workflow steps and jobs, based on the files modified by pull request, on a feature
3
+
[GitHub Action](https://github.com/features/actions) that enables conditional execution of workflow steps and jobs, based on the files modified by pull request, on a feature
4
4
branch, or by the recently pushed commits.
5
5
6
6
Run slow tasks like integration tests or deployments only for changed components. It saves time and resources, especially in monorepo setups.
- Workflow triggered by **[pull_request](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request)**
18
19
or **[pull_request_target](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target)** event
19
20
- Changes are detected against the pull request base branch
20
-
- Uses Github REST API to fetch a list of modified files
21
+
- Uses GitHub REST API to fetch a list of modified files
21
22
-**Feature branches:**
22
23
- Workflow triggered by **[push](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push)**
23
24
or any other **[event](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)**
@@ -41,6 +42,7 @@ don't allow this because they don't work on a level of individual jobs or steps.
41
42
- Untracked files are ignored
42
43
43
44
## Example
45
+
44
46
```yaml
45
47
- uses: dorny/paths-filter@v2
46
48
id: changes
@@ -50,12 +52,14 @@ don't allow this because they don't work on a level of individual jobs or steps.
50
52
- 'src/**'
51
53
52
54
# run only if some file in 'src' folder was changed
53
-
if: steps.changes.outputs.src == 'true'
55
+
-if: steps.changes.outputs.src == 'true'
54
56
run: ...
55
57
```
58
+
56
59
For more scenarios see [examples](#examples) section.
57
60
58
-
## Notes:
61
+
## Notes
62
+
59
63
- Paths expressions are evaluated using [picomatch](https://github.com/micromatch/picomatch) library.
60
64
Documentation for path expression format can be found on the project GitHub page.
61
65
- Picomatch [dot](https://github.com/micromatch/picomatch#options) option is set to true.
@@ -64,8 +68,8 @@ For more scenarios see [examples](#examples) section.
64
68
- Local execution with [act](https://github.com/nektos/act) works only with alternative runner image. Default runner doesn't have `git` binary.
- Configure matrix job to run for each folder with changes using `changes` output
@@ -74,7 +78,7 @@ For more scenarios see [examples](#examples) section.
74
78
75
79
For more information, see [CHANGELOG](https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md)
76
80
77
-
# Usage
81
+
## Usage
78
82
79
83
```yaml
80
84
- uses: dorny/paths-filter@v2
@@ -139,26 +143,27 @@ For more information, see [CHANGELOG](https://github.com/dorny/paths-filter/blob
139
143
working-directory: ''
140
144
141
145
# Personal access token used to fetch a list of changed files
142
-
# from Github REST API.
146
+
# from GitHub REST API.
143
147
# It's only used if action is triggered by a pull request event.
144
-
# Github token from workflow context is used as default value.
148
+
# GitHub token from workflow context is used as default value.
145
149
# If an empty string is provided, the action falls back to detect
146
150
# changes using git commands.
147
151
# Default: ${{ github.token }}
148
152
token: ''
149
153
```
150
154
151
155
## Outputs
156
+
152
157
- For each filter, it sets output variable named by the filter to the text:
153
-
- `'true'`- if **any** of changed files matches any of filter rules
154
-
- `'false'`- if **none** of changed files matches any of filter rules
158
+
- `'true'`- if **any** of changed files matches any of filter rules
159
+
- `'false'`- if **none** of changed files matches any of filter rules
155
160
- For each filter, it sets an output variable with the name `${FILTER_NAME}_count` to the count of matching files.
156
161
- If enabled, for each filter it sets an output variable with the name `${FILTER_NAME}_files`. It will contain a list of all files matching the filter.
157
162
- `changes`- JSON array with names of all filters matching any of the changed files.
158
163
159
-
# Examples
164
+
## Examples
160
165
161
-
## Conditional execution
166
+
### Conditional execution
162
167
163
168
<details>
164
169
<summary>Execute <b>step</b> in a workflow job only if some file in a subfolder is changed</summary>
- [test-reporter](https://github.com/dorny/test-reporter) - Displays test results from popular testing frameworks directly in GitHub
493
510
494
-
# License
511
+
## License
495
512
496
513
The scripts and documentation in this project are released under the [MIT License](https://github.com/dorny/paths-filter/blob/master/LICENSE)
0 commit comments