Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-weisberg-qz committed Aug 20, 2024
1 parent 1870d30 commit 8e58c3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ async function getApps(): Promise<App[]> {
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;
}
Expand Down Expand Up @@ -243,8 +242,9 @@ async function getChangedFiles(): Promise<string[]> {
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);
Expand Down

0 comments on commit 8e58c3a

Please sign in to comment.