diff --git a/.github/workflows/pull-request-verification.yml b/.github/workflows/pull-request-verification.yml index b18d7ba2..801c7cea 100644 --- a/.github/workflows/pull-request-verification.yml +++ b/.github/workflows/pull-request-verification.yml @@ -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 diff --git a/README.md b/README.md index b6328372..e6234777 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/dist/index.js b/dist/index.js index d2b9ab4e..35a3f9e5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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); diff --git a/src/main.ts b/src/main.ts index 844b5e49..3e9522fe 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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)