Skip to content

Commit

Permalink
Merge pull request #65 from dorny/add-count-output
Browse files Browse the repository at this point in the history
Add count output
  • Loading branch information
dorny authored Jan 29, 2021
2 parents 363576b + a273049 commit cbc3287
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pull-request-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ jobs:
- name: filter-test
if: steps.filter.outputs.local != 'true'
run: exit 1
- name: count-test
if: steps.filter.outputs.local_count != 1
run: exit 1

test-change-type:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ For more information see [CHANGELOG](https://github.com/dorny/paths-filter/blob/
- For each filter it sets output variable named by the filter to the text:
- `'true'` - if **any** of changed files matches any of filter rules
- `'false'` - if **none** of changed files matches any of filter rules
- For each filter it sets output variable with name `${FILTER_NAME}_count` to the count of matching files.
- If enabled, for each filter it sets output variable with name `${FILTER_NAME}_files`. It will contain list of all files matching the filter.
- `changes` - JSON array with names of all filters matching any of changed files.

Expand Down
1 change: 1 addition & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4806,6 +4806,7 @@ function exportResults(results, format) {
core.info('Matching files: none');
}
core.setOutput(key, value);
core.setOutput(`${key}_count`, files.length);
if (format !== 'none') {
const filesValue = serializeExport(files, format);
core.setOutput(`${key}_files`, filesValue);
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ function exportResults(results: FilterResults, format: ExportFormat): void {
}

core.setOutput(key, value)
core.setOutput(`${key}_count`, files.length)
if (format !== 'none') {
const filesValue = serializeExport(files, format)
core.setOutput(`${key}_files`, filesValue)
Expand Down

0 comments on commit cbc3287

Please sign in to comment.