From 8e58c3a7f4334633622f55cee550a56b94ccbf4f Mon Sep 17 00:00:00 2001 From: Aaron Weisberg Date: Tue, 20 Aug 2024 09:34:09 -0700 Subject: [PATCH] update --- dist/index.js | 8 ++++---- src/main.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index 62cc25c..44c4a04 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1771,8 +1771,7 @@ function getApps() { const changedFiles = yield getChangedFiles(); console.log(`Changed files: ${changedFiles.join(', ')}`); const changedInThisPR = repoApps.filter(app => { - const appPath = app.spec.source.path; - return isInArgoCDSourceRepo(changedFiles, appPath); + return partOfApp(changedFiles, app); }); return changedInThisPR; }); @@ -1876,8 +1875,9 @@ function getChangedFiles() { return changedFiles; }); } -function isInArgoCDSourceRepo(changedFiles, argoCdRepoPath) { - const appPath = getFirstTwoDirectories(path.normalize(argoCdRepoPath)); +function partOfApp(changedFiles, app) { + const sourcePath = path.normalize(app.spec.source.path); + const appPath = getFirstTwoDirectories(sourcePath); return changedFiles.some(file => { const normalizedFilePath = path.normalize(file); return normalizedFilePath.startsWith(appPath); diff --git a/src/main.ts b/src/main.ts index 43c7109..26f8f8a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -120,8 +120,7 @@ async function getApps(): Promise { const changedFiles = await getChangedFiles(); console.log(`Changed files: ${changedFiles.join(', ')}`); const changedInThisPR = repoApps.filter(app => { - const appPath = app.spec.source.path - return isInArgoCDSourceRepo(changedFiles, appPath) + return partOfApp(changedFiles, app) }); return changedInThisPR; } @@ -243,8 +242,9 @@ async function getChangedFiles(): Promise { return changedFiles; } -function isInArgoCDSourceRepo(changedFiles: string[], argoCdRepoPath: string): boolean { - const appPath = getFirstTwoDirectories(path.normalize(argoCdRepoPath)); +function partOfApp(changedFiles: string[], app: App): boolean { + const sourcePath = path.normalize(app.spec.source.path); + const appPath = getFirstTwoDirectories(sourcePath); return changedFiles.some(file => { const normalizedFilePath = path.normalize(file);