Merge pull request #65 from dorny/add-count-output

Add count output
This commit is contained in:
Michal Dorner 2021-01-29 20:03:56 +01:00 committed by GitHub
commit cbc3287af3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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.

1
dist/index.js vendored
View File

@ -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);

View File

@ -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)