From d3fe997a3f7f800723902145d55be32af7fa4453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADdio=20Dolfini?= Date: Thu, 20 Aug 2026 15:51:06 -0300 Subject: [PATCH] fix(appdir): include multi-source apps when any source matches the branch getTargetRevision reads only Sources[0]; a chart-first multi-source app (OCI chart pinned in source[0], values in a git ref source) was excluded because the chart's targetRevision (a version) never equals the PR target branch. shouldInclude now iterates all sources. --- pkg/appdir/app_directory.go | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/pkg/appdir/app_directory.go b/pkg/appdir/app_directory.go index fd3f9b6c..d1c66d47 100644 --- a/pkg/appdir/app_directory.go +++ b/pkg/appdir/app_directory.go @@ -116,23 +116,24 @@ func getSourcePath(app v1alpha1.Application) string { } func shouldInclude(app v1alpha1.Application, targetBranch string) bool { - targetRevision := getTargetRevision(app) - if targetRevision == "" { - return true - } - - if targetRevision == targetBranch { - return true - } - - if targetRevision == "HEAD" { - if targetBranch == "main" { + // Consider every source: a multi-source Application whose values live in a + // git source (targetRevision=) must be included even when the first + // source is a versioned Helm chart (targetRevision=). + // getTargetRevision(app) only reads app.Spec.GetSource() == Sources[0], so + // "chart-first" multi-source apps were incorrectly excluded from PR checks. + for _, source := range getSources(app) { + targetRevision := source.TargetRevision + if targetRevision == "" { return true } - - if targetBranch == "master" { + if targetRevision == targetBranch { return true } + if targetRevision == "HEAD" { + if targetBranch == "main" || targetBranch == "master" { + return true + } + } } return false