Skip to content

Enhance customALGoFiles feature#2273

Open
OleWunschmann wants to merge 13 commits into
microsoft:mainfrom
OleWunschmann:enhance-customALGoFiles-feature
Open

Enhance customALGoFiles feature#2273
OleWunschmann wants to merge 13 commits into
microsoft:mainfrom
OleWunschmann:enhance-customALGoFiles-feature

Conversation

@OleWunschmann

Copy link
Copy Markdown
Contributor

❔What, Why & How

New file removal feature:

  • Added a new filesToRemove field to the customALGoFiles section in both the in-memory settings and the JSON schema, allowing users to specify files that should always be removed from the repository during updates, regardless of their presence in the template. (Actions/.Modules/ReadSettings.psm1, Actions/.Modules/settings.schema.json) [1] [2]

Update logic improvements:

  • Refactored the logic in GetFilesToUpdate and related helper functions to merge filesToInclude, filesToExclude, and filesToRemove from both repository and template settings, propagate removals from upstream templates, and correctly resolve file paths for removal operations. (Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1) [1] [2] [3]

  • Added the ResolveFilePathsInDestinationFolder function to accurately identify files for removal in the target repository, supporting per-project and destination-relative path resolution. (Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1)

Telemetry and settings handling:

  • Enhanced telemetry to track usage of filesToInclude, filesToExclude, and filesToRemove for both repository and template settings, providing better insights into feature adoption. (Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1)

  • Updated the call to ReadSettings to include the -trigger parameter, ensuring settings are read with the correct context. (Actions/CheckForUpdates/CheckForUpdates.ps1)

  • Prepared for template settings merging by initializing $templateRepoSettings and adjusting template download logic. (Actions/CheckForUpdates/CheckForUpdates.ps1)

Related to discussion: #2227

✅ Checklist

  • Add tests (E2E, unit tests)
  • Update RELEASENOTES.md
  • Update documentation (e.g. for new settings or scenarios)
  • Add telemetry

Copilot AI review requested due to automatic review settings June 3, 2026 15:24
@OleWunschmann
OleWunschmann requested a review from a team as a code owner June 3, 2026 15:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR enhances the customALGoFiles behavior during “Update AL-Go System Files”, adding support for unconditional removals (filesToRemove) and improving custom-template behavior by merging template settings directly and resolving files from the original AL-Go template where applicable.

Changes:

  • Add customALGoFiles.filesToRemove support end-to-end (schema, defaults, resolution logic, docs, and release notes).
  • Update CheckForUpdates to read template repo settings via ReadSettings and merge template settings during file resolution.
  • Expand automated coverage (unit + e2e) for include/exclude/remove resolution and custom-template propagation.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
e2eTests/scenarios/CustomTemplate/runtest.ps1 Extends e2e scenario to validate custom-template file include/exclude/remove propagation and workflow presence.
Tests/CheckForUpdates.Action.Test.ps1 Adds unit tests for destination-folder resolution and expanded GetFilesToUpdate behaviors (including filesToRemove).
Actions/CheckForUpdates/CheckForUpdates.ps1 Updates settings reading (incl. trigger) and wires template settings + filesToRemove into update/removal flow.
Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 Implements ResolveFilePathsInDestinationFolder and extends GetFilesToUpdate to produce include/exclude/remove lists.
Actions/.Modules/settings.schema.json Extends settings schema with customALGoFiles.filesToRemove and clarifying descriptions.
Actions/.Modules/ReadSettings.psm1 Adds default filesToRemove array under customALGoFiles.
Scenarios/settings.md Documents customALGoFiles.filesToRemove in settings reference.
Scenarios/CustomizingALGoForGitHub.md Adds conceptual docs + examples for original-template resolution and filesToRemove.
RELEASENOTES.md Documents enhanced customALGoFiles behavior and new filesToRemove.

Comment thread Tests/CheckForUpdates.Action.Test.ps1
Comment thread Tests/CheckForUpdates.Action.Test.ps1
Comment thread e2eTests/scenarios/CustomTemplate/runtest.ps1
Comment thread e2eTests/scenarios/CustomTemplate/runtest.ps1
Comment thread Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 Outdated
Comment thread Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1
Comment thread e2eTests/scenarios/CustomTemplate/runtest.ps1 Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comment thread Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1
Comment thread Scenarios/CustomizingALGoForGitHub.md
Comment on lines +789 to +805
"sourceFolder": {
"type": "string",
"description": "The source folder from which to remove files, relative to the template repository root."
},
"filter": {
"type": "string",
"description": "A filter string to select which files to remove. It can contain '*' and '?' wildcards."
},
"destinationFolder": {
"type": "string",
"description": "The destination folder where the files should be removed, relative to the repository root."
},
"perProject": {
"type": "boolean",
"description": "Indicates whether the removal should be applied per project. In that case, destinationFolder is relative to each project folder."
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the support for destinationName based on the same property of filesToInclude, which is also not documented or defined in the schema.

@mazhelez What do you think about adding the property for filesToInclude and filesToRemove in the documentation and schema?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I extended the schema and documentation for property destinationName

@OleWunschmann

Copy link
Copy Markdown
Contributor Author

@mazhelez The failing PS5 tests should be fixed now.

Comment thread RELEASENOTES.md
Comment thread RELEASENOTES.md
@OleWunschmann
OleWunschmann requested a review from spetersenms July 9, 2026 17:11
}
},
"filesToRemove": {
"description": "An array of file specifications to unconditionally remove from the repository during 'Update AL-Go System Files', regardless of whether the files exist in the template. Useful for cleaning up files that have been removed from the template but may still exist in repositories.",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... regardless of whether the files exist in the template

That's the part that made us leave out filesToRemove from the initial implementation of "custom AL-Go files".

If the files are not in the template, they are not considered AL-Go files, so why would AL-Go clean them up?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now a custom template (and AL-Go) cannot remove/rename a file, because these changes in the template are not propagated to repos that use it.
The current workaround is to keep the file in the template and add it to "filesToExclude". This works, but it’s messy and pollutes the template repository.

With filesToRemove a custom template could remove files in the final repositories without the need to keep them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants