diff --git a/dist/index.js b/dist/index.js index f20fcd5b..d62c9d0e 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/index.js.map b/dist/index.js.map index 07826d0a..3c2c695a 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/src/__tests__/utils.test.ts b/src/__tests__/utils.test.ts index 3599a29c..d4ec1750 100644 --- a/src/__tests__/utils.test.ts +++ b/src/__tests__/utils.test.ts @@ -315,7 +315,14 @@ describe('utils test', () => { // Tests that the function returns only the files that match the file patterns it('should return only the files that match the file patterns', async () => { const allDiffFiles = { - [ChangeTypeEnum.Added]: ['file1.txt', 'file2.md', 'file3.txt'], + [ChangeTypeEnum.Added]: [ + 'file1.txt', + 'file2.md', + 'file3.txt', + 'test/dir/file4.txt', + '/test/dir/file5.txt', + 'dir/file6.md' + ], [ChangeTypeEnum.Copied]: [], [ChangeTypeEnum.Deleted]: [], [ChangeTypeEnum.Modified]: [], diff --git a/src/changedFilesOutput.ts b/src/changedFilesOutput.ts index 0e6f580a..41c267e2 100644 --- a/src/changedFilesOutput.ts +++ b/src/changedFilesOutput.ts @@ -6,7 +6,7 @@ import { getChangeTypeFiles } from './changedFiles' import {Inputs} from './inputs' -import {getFilteredChangedFiles, setOutput} from './utils' +import {setOutput} from './utils' const getOutputKey = (key: string, outputPrefix: string): string => { return outputPrefix ? `${outputPrefix}_${key}` : key @@ -14,21 +14,17 @@ const getOutputKey = (key: string, outputPrefix: string): string => { export const setChangedFilesOutput = async ({ allDiffFiles, + allFilteredDiffFiles, inputs, filePatterns = [], outputPrefix = '' }: { allDiffFiles: ChangedFiles + allFilteredDiffFiles: ChangedFiles inputs: Inputs filePatterns?: string[] outputPrefix?: string }): Promise => { - const allFilteredDiffFiles = await getFilteredChangedFiles({ - allDiffFiles, - filePatterns - }) - core.debug(`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`) - const addedFiles = await getChangeTypeFiles({ inputs, changedFiles: allFilteredDiffFiles, diff --git a/src/main.ts b/src/main.ts index e7a97dc5..a8330e53 100644 --- a/src/main.ts +++ b/src/main.ts @@ -18,6 +18,7 @@ import {Env, getEnv} from './env' import {getInputs, Inputs} from './inputs' import { getFilePatterns, + getFilteredChangedFiles, getRecoverFilePatterns, getSubmodulePath, getYamlFilePatterns, @@ -43,10 +44,18 @@ const changedFilesOutput = async ({ }): Promise => { if (filePatterns.length > 0) { core.startGroup('changed-files-patterns') + const allFilteredDiffFiles = await getFilteredChangedFiles({ + allDiffFiles, + filePatterns + }) + core.debug( + `All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}` + ) await setChangedFilesOutput({ allDiffFiles, - filePatterns, - inputs + allFilteredDiffFiles, + inputs, + filePatterns }) core.info('All Done!') core.endGroup() @@ -55,11 +64,21 @@ const changedFilesOutput = async ({ if (Object.keys(yamlFilePatterns).length > 0) { for (const key of Object.keys(yamlFilePatterns)) { core.startGroup(`changed-files-yaml-${key}`) + const allFilteredDiffFiles = await getFilteredChangedFiles({ + allDiffFiles, + filePatterns: yamlFilePatterns[key] + }) + core.debug( + `All filtered diff files for ${key}: ${JSON.stringify( + allFilteredDiffFiles + )}` + ) await setChangedFilesOutput({ allDiffFiles, + allFilteredDiffFiles, + inputs, filePatterns: yamlFilePatterns[key], - outputPrefix: key, - inputs + outputPrefix: key }) core.info('All Done!') core.endGroup() @@ -70,6 +89,7 @@ const changedFilesOutput = async ({ core.startGroup('changed-files-all') await setChangedFilesOutput({ allDiffFiles, + allFilteredDiffFiles: allDiffFiles, inputs }) core.info('All Done!')