mirror of
https://github.com/dorny/paths-filter.git
synced 2025-06-08 00:59:04 +00:00
Extend filter syntax with optional specification of file status: add, modified, deleted (#22)
* Add support for specification of change type (add,modified,delete) * Use NULL as separator in git-diff command output * Improve PR test workflow * Fix the workflow file
This commit is contained in:
parent
caef9bef1f
commit
1ff702da35
11 changed files with 397 additions and 90 deletions
|
@ -20,8 +20,10 @@ Supported workflows:
|
|||
## Usage
|
||||
|
||||
Filter rules are defined using YAML format.
|
||||
Each filter rule is a list of [glob expressions](https://github.com/isaacs/minimatch).
|
||||
Corresponding output variable will be created to indicate if there's a changed file matching any of the rule glob expressions.
|
||||
Each filter has a name and set of rules.
|
||||
Rule is a [glob expressions](https://github.com/isaacs/minimatch).
|
||||
Optionally you specify if the file should be added, modified or deleted to be matched.
|
||||
For each filter there will be corresponding output variable to indicate if there's a changed file matching any of the rules.
|
||||
Output variables can be later used in the `if` clause to conditionally run specific steps.
|
||||
|
||||
### Inputs
|
||||
|
@ -30,7 +32,7 @@ Output variables can be later used in the `if` clause to conditionally run speci
|
|||
- **`base`**: Git reference (e.g. branch name) against which the changes will be detected. Defaults to repository default branch (e.g. master).
|
||||
If it references same branch it was pushed to, changes are detected against the most recent commit before the push.
|
||||
This option is ignored if action is triggered by *pull_request* event.
|
||||
- **`filters`**: Path to the configuration file or directly embedded string in YAML format. Filter configuration is a dictionary, where keys specifies rule names and values are lists of file path patterns.
|
||||
- **`filters`**: Path to the configuration file or directly embedded string in YAML format.
|
||||
|
||||
### Outputs
|
||||
- For each rule it sets output variable named by the rule to text:
|
||||
|
@ -41,6 +43,7 @@ Output variables can be later used in the `if` clause to conditionally run speci
|
|||
- minimatch [dot](https://www.npmjs.com/package/minimatch#dot) option is set to true - therefore
|
||||
globbing will match also paths where file or folder name starts with a dot.
|
||||
- You can use YAML anchors to reuse path expression(s) inside another rule. See example in the tests.
|
||||
- It's recommended to put quote your path expressions with `'` or `"`. Otherwise you will get an error if it starts with `*`.
|
||||
- If changes are detected against the previous commit and there is none (i.e. first push of a new branch), all filter rules will report changed files.
|
||||
- You can use `base: ${{ github.ref }}` to configure change detection against previous commit for every branch you create.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue