Fix modifiedApps incremental builds for projects with external appFolders#2194
Open
Groenbech96 wants to merge 1 commit intomicrosoft:mainfrom
Open
Fix modifiedApps incremental builds for projects with external appFolders#2194Groenbech96 wants to merge 1 commit intomicrosoft:mainfrom
Groenbech96 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
…l appFolders When a project is nested (e.g. build/projects/MyProject) and its appFolders reference sources outside the project via ../ paths, the modifiedApps incremental build mode failed to match any unmodified apps for baseline download. This caused all apps to be recompiled on every PR even when only one file changed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes incremental builds in modifiedApps mode for projects whose appFolders resolve to paths outside the project directory (via ../), ensuring unmodified apps can be downloaded from the baseline workflow run instead of always being rebuilt.
Changes:
- Replace brittle
SubString(2)-based folder matching with a new helper that resolves project-relative folders and converts them to repo-relative paths for comparison. - Add Pester coverage for both nested-project (
../paths) and standard (.\paths) layouts to prevent regressions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.psm1 | Fixes skip/download folder matching by resolving to absolute paths and converting to repo-relative paths before comparing with $skipFolders. |
| Tests/DetermineProjectsToBuild.Test.ps1 | Adds two tests validating correct unmodified-app detection for external appFolders and standard in-project folders. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mazhelez
reviewed
Apr 1, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
incrementalBuilds.modeis set tomodifiedAppsand a project references app folders outside its own directory via../paths, unmodified apps are never downloaded from the baseline workflow run. Instead, every app is recompiled on every PR — even when only a single file changed.The bug
Get-UnmodifiedAppsFromBaselineWorkflowRunneeds to match entries from$settings.appFolders(project-relative paths) against$skipFolders(repo-relative paths). The old code assumed all resolved folder paths start with.\and usedSubString(2)to strip that prefix:This works when apps live inside the project folder (paths like
.\app), but breaks when apps live outside (paths like..\..\..\src\Apps\SomeApp\App).Toy example to illustrate
Consider a repo layout where a project at
build/projects/MyProjectreferences apps atsrc/:After
ResolveProjectFoldersresolves the glob from the project directory,$settings.appFolderscontains:Meanwhile,
$skipFolders(fromGetFoldersFromAllProjects, resolved from the repo root) contains:The old matching logic did:
$_.SubString(2)on..\..\..\src\Apps\Reporting\App\..\..\src\Apps\Reporting\Appbuild\projects\MyProject\..\..\src\Apps\Reporting\App$skipFolderssrc\Apps\Reporting\AppThe result:
$downloadAppFoldersis always empty → no artifacts downloaded from baseline → all apps recompiled.For comparison, the standard layout (apps inside the project) works because paths start with
.\:$_.SubString(2)on.\appappapp$skipFoldersappThe fix
Replace the
SubString(2)hack with proper path resolution. A new helperConvertTo-RepoRelativePathresolves each project-relative folder to an absolute path viaJoin-Path -Resolve, then strips the base folder prefix to produce a clean repo-relative path that matches$skipFoldersexactly:This works for both layouts:
$settings.appFoldersentry$skipFolders?..\..\..\src\Apps\Reporting\AppD:\a\repo\src\Apps\Reporting\Appsrc\Apps\Reporting\App.\appD:\a\repo\appappTests
Two new Pester tests added to
DetermineProjectsToBuild.Test.ps1:../paths — creates a repo layout where apps are outside the project folder. Fails without the fix (Download appFolders: - None), passes with the fix.Test plan