Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0d9e05e
Enhance customALGoFiles feature (#3)
OleWunschmann Jun 3, 2026
73f4ef3
fixed typo
OleWunschmann Jun 3, 2026
bb38962
fixed function description
OleWunschmann Jun 3, 2026
50ad11c
Fixed tests for ps5 and string-prefix check for folder traversal
OleWunschmann Jun 9, 2026
7aa8766
Merge branch 'main' into enhance-customALGoFiles-feature
OleWunschmann Jun 9, 2026
f7496cc
Merge branch 'main' into enhance-customALGoFiles-feature
OleWunschmann Jun 12, 2026
11e2efc
Merge branch 'main' into enhance-customALGoFiles-feature
OleWunschmann Jun 16, 2026
b021013
Merge branch 'main' into enhance-customALGoFiles-feature
OleWunschmann Jun 17, 2026
025747e
Merge branch 'main' into enhance-customALGoFiles-feature
OleWunschmann Jun 22, 2026
dd1771a
Merge remote-tracking branch 'origin/main' into enhance-customALGoFil…
OleWunschmann Jun 30, 2026
2d24972
Merge remote-tracking branch 'origin/main' into enhance-customALGoFil…
OleWunschmann Jul 9, 2026
5976abe
Merge remote-tracking branch 'origin/main' into enhance-customALGoFil…
OleWunschmann Jul 14, 2026
7fa3522
Extended settings schema and documentation for "destinationName"
OleWunschmann Jul 14, 2026
a5c5fb1
Merge branch 'main' into enhance-customALGoFiles-feature
OleWunschmann Jul 20, 2026
181080e
Merge branch 'main' into enhance-customALGoFiles-feature
OleWunschmann Jul 21, 2026
c23a8ae
Merge branch 'main' into enhance-customALGoFiles-feature
OleWunschmann Jul 21, 2026
afce6d7
Potential fix for pull request finding
OleWunschmann Jul 23, 2026
00d1902
Fixed copilot review comments
OleWunschmann Jul 23, 2026
ee510bd
Merge branch 'main' into enhance-customALGoFiles-feature
OleWunschmann Jul 23, 2026
c8ded0d
Fix copilot review comments
OleWunschmann Jul 24, 2026
409371e
Cleanup
OleWunschmann Jul 24, 2026
84a656e
Cleanup
OleWunschmann Jul 24, 2026
8682d62
Fix copilot review comments
OleWunschmann Jul 24, 2026
051d08a
Remove support for fileToRemove
OleWunschmann Jul 29, 2026
1a037b8
Merge remote-tracking branch 'origin/main' into enhance-customALGoFil…
OleWunschmann Jul 29, 2026
d412a75
Fixed copilot review comment
OleWunschmann Jul 29, 2026
6376e16
Fixed issues
OleWunschmann Jul 29, 2026
73e159c
Cleanup
OleWunschmann Jul 29, 2026
cf71143
Fixed boundary escape for destinationFolder and destinationName
OleWunschmann Jul 29, 2026
f94fe4e
Merge branch 'main' into enhance-customALGoFiles-feature
OleWunschmann Jul 31, 2026
61c640d
Fixed boundary escape for destinationName and typos
OleWunschmann Jul 31, 2026
ea2688e
Fixed boundry escape for wildcards and for linux
OleWunschmann Jul 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Actions/.Modules/ReadSettings.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ function GetDefaultSettings
"customALGoFiles" = [ordered]@{
"filesToInclude" = @()
"filesToExclude" = @()
"filesToRemove" = @()
}
"postponeProjectInBuildOrder" = $false
}
Expand Down
27 changes: 27 additions & 0 deletions Actions/.Modules/settings.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,7 @@
"type": "object",
"properties": {
"filesToInclude": {
"description": "An array of file specifications to include in the update. Files that match these specifications are copied from the template to the repository. When used in a custom template's settings, inclusions are also propagated from the original template to consumer repos even if the files no longer exist in the custom template.",
"type": "array",
"items": {
"type": "object",
Expand All @@ -763,6 +764,7 @@
}
},
"filesToExclude": {
"description": "An array of file specifications to exclude from the update. Files that match these specifications are not copied from the template to the repository. When used in a custom template's settings, exclusions are also propagated from the original template to consumer repos even if the files no longer exist in the custom template.",
"type": "array",
"items": {
"type": "object",
Expand All @@ -777,6 +779,31 @@
}
}
}
},
"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.",
Comment thread
aholstrup1 marked this conversation as resolved.
Outdated
"type": "array",
"items": {
"type": "object",
"properties": {
"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."
}
}
Comment thread
mazhelez marked this conversation as resolved.
Outdated
}
}
}
},
Expand Down
228 changes: 196 additions & 32 deletions Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1

Large diffs are not rendered by default.

71 changes: 35 additions & 36 deletions Actions/CheckForUpdates/CheckForUpdates.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if ($token) {
# if $downloadLatest is set to true, CheckForUpdates will download the latest version of the template repository, else it will use the templateSha setting in the .github/AL-Go-Settings file

# Get Repo settings as a hashtable (do NOT read any specific project settings, nor any specific workflow, user or branch settings)
$repoSettings = ReadSettings -buildMode '' -project '' -workflowName '' -userName '' -branchName '' | ConvertTo-HashTable -recurse
$repoSettings = ReadSettings -buildMode '' -project '' -workflowName '' -userName '' -branchName '' -trigger '' | ConvertTo-HashTable -recurse
$templateSha = $repoSettings.templateSha

# If templateUrl has changed, download latest version of the template repository (ignore templateSha)
Expand All @@ -61,6 +61,7 @@ if ($repoSettings.templateUrl -ne $templateUrl -or $templateSha -eq '') {
}

$originalTemplateFolder = $null
$templateRepoSettings = $null
$templateFolder = DownloadTemplateRepository -token $token -templateUrl $templateUrl -templateSha ([ref]$templateSha) -downloadLatest $downloadLatest
$templateFolder = GetSrcFolder -repoType $repoSettings.type -templateUrl $templateUrl -templateFolder $templateFolder
Write-Host "Template Folder: $templateFolder"
Expand All @@ -71,42 +72,40 @@ $templateInfo = "$templateOwner/$($templateUrl.Split('/')[4])"

$isDirectALGo = IsDirectALGo -templateUrl $templateUrl
if (-not $isDirectALGo) {
$templateRepoSettingsFile = Join-Path $templateFolder $RepoSettingsFile
if (Test-Path -Path $templateRepoSettingsFile -PathType Leaf) {
$templateRepoSettings = Get-Content $templateRepoSettingsFile -Encoding UTF8 | ConvertFrom-Json | ConvertTo-HashTable -Recurse
if ($templateRepoSettings.Keys -contains "templateUrl" -and $templateRepoSettings.templateUrl -ne $templateUrl) {
# The template repository is a url to another AL-Go repository (a custom template repository)
Trace-Information -Message "Using custom AL-Go template repository"

# TemplateUrl and TemplateSha from .github/AL-Go-Settings.json in the custom template repository points to the "original" template repository
# Copy files and folders from the custom template repository, but grab the unmodified file from the "original" template repository if it exists and apply customizations
# Copy .github/AL-Go-Settings.json to .github/templateRepoSettings.doNotEdit.json (will be read before .github/AL-Go-Settings.json in the final repo)
# Copy .AL-Go/settings.json to .github/templateProjectSettings.doNotEdit.json (will be read before .AL-Go/settings.json in the final repo)

Write-Host "Custom AL-Go template repository detected, downloading the 'original' template repository"
$originalTemplateUrl = $templateRepoSettings.templateUrl
if ($templateRepoSettings.Keys -contains "templateSha") {
$originalTemplateSha = $templateRepoSettings.templateSha
}
else {
$originalTemplateSha = ""
}
# Get template Repo settings as a hashtable (do NOT read any variable settings, specific project settings, nor any specific workflow, user or branch settings)
$templateRepoSettings = ReadSettings -baseFolder $templateFolder -buildMode '' -project '' -workflowName '' -userName '' -branchName '' -trigger '' -orgSettingsVariableValue '' -repoSettingsVariableValue '' -environmentSettingsVariableValue '' | ConvertTo-HashTable -recurse
if ($templateRepoSettings.templateUrl -and $templateRepoSettings.templateUrl -ne $templateUrl) {
# The template repository is a url to another AL-Go repository (a custom template repository)
Trace-Information -Message "Using custom AL-Go template repository"

# TemplateUrl and TemplateSha from .github/AL-Go-Settings.json in the custom template repository points to the "original" template repository
# Copy files and folders from the custom template repository, but grab the unmodified file from the "original" template repository if it exists and apply customizations
# Copy .github/AL-Go-Settings.json to .github/templateRepoSettings.doNotEdit.json (will be read before .github/AL-Go-Settings.json in the final repo)
# Copy .AL-Go/settings.json to .github/templateProjectSettings.doNotEdit.json (will be read before .AL-Go/settings.json in the final repo)

Write-Host "Custom AL-Go template repository detected, downloading the 'original' template repository"
$originalTemplateUrl = $templateRepoSettings.templateUrl
if ($templateRepoSettings.Keys -contains "templateSha") {
$originalTemplateSha = $templateRepoSettings.templateSha
}
else {
$originalTemplateSha = ""
}

# Download the "original" template repository - use downloadLatest if no TemplateSha is specified in the custom template repository
$originalTemplateFolder = DownloadTemplateRepository -token $token -templateUrl $originalTemplateUrl -templateSha ([ref]$originalTemplateSha) -downloadLatest ($originalTemplateSha -eq '')
$originalTemplateFolder = GetSrcFolder -repoType $repoSettings.type -templateUrl $originalTemplateUrl -templateFolder $originalTemplateFolder
# Download the "original" template repository - use downloadLatest if no TemplateSha is specified in the custom template repository
$originalTemplateFolder = DownloadTemplateRepository -token $token -templateUrl $originalTemplateUrl -templateSha ([ref]$originalTemplateSha) -downloadLatest ($originalTemplateSha -eq '')
$originalTemplateFolder = GetSrcFolder -repoType $repoSettings.type -templateUrl $originalTemplateUrl -templateFolder $originalTemplateFolder

Write-Host "Original Template Folder: $originalTemplateFolder"
Write-Host "Original Template Folder: $originalTemplateFolder"

# Set TemplateBranch and TemplateOwner
# Keep TemplateUrl and TemplateSha pointing to the custom template repository
$templateBranch = $originalTemplateUrl.Split('@')[1]
$templateOwner = $originalTemplateUrl.Split('/')[3]
# Set TemplateBranch and TemplateOwner
# Keep TemplateUrl and TemplateSha pointing to the custom template repository
$templateBranch = $originalTemplateUrl.Split('@')[1]
$templateOwner = $originalTemplateUrl.Split('/')[3]

$isDirectALGo = IsDirectALGo -templateUrl $originalTemplateUrl
if ($isDirectALGo) {
Trace-Information -Message "Original template repository is direct AL-Go"
}
$isDirectALGo = IsDirectALGo -templateUrl $originalTemplateUrl
if ($isDirectALGo) {
Trace-Information -Message "Original template repository is direct AL-Go"
}
}
}
Expand All @@ -115,7 +114,7 @@ if (-not $isDirectALGo) {
$baseFolder = $ENV:GITHUB_WORKSPACE
$projects = @(GetProjectsFromRepository -baseFolder $baseFolder -projectsFromSettings $repoSettings.projects)

$filesToInclude, $filesToExclude = GetFilesToUpdate -settings $repoSettings -projects $projects -baseFolder $baseFolder -templateFolder $templateFolder -originalTemplateFolder $originalTemplateFolder
$filesToInclude, $filesToExclude, $filesToRemove = GetFilesToUpdate -settings $repoSettings -projects $projects -baseFolder $baseFolder -templateFolder $templateFolder -templateSettings $templateRepoSettings -originalTemplateFolder $originalTemplateFolder
Comment thread
aholstrup1 marked this conversation as resolved.
Outdated

# $updateFiles will hold an array of files, which needs to be updated
$updateFiles = @()
Expand Down Expand Up @@ -203,8 +202,8 @@ foreach($fileToInclude in $filesToInclude) {
}

Push-Location -Path $baseFolder
# Remove files that are in $filesToExclude and exist in the repository
$removeFiles = $filesToExclude | Where-Object { $_ -and (Test-Path -Path $_.destinationFullPath -PathType Leaf) } | ForEach-Object {
# Remove files that are in $filesToExclude or $filesToRemove and exist in the repository
$removeFiles = @($filesToExclude) + @($filesToRemove) | Where-Object { $_ -and (Test-Path -Path $_.destinationFullPath -PathType Leaf) } | ForEach-Object {
Comment thread
aholstrup1 marked this conversation as resolved.
Outdated
$relativePath = Resolve-Path -Path $_.destinationFullPath -Relative
Comment thread
mazhelez marked this conversation as resolved.
Outdated
Write-Host "File marked for removal: $relativePath"
$relativePath
Expand Down
10 changes: 10 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
### Enhanced `customALGoFiles` setting
Comment thread
mazhelez marked this conversation as resolved.
Comment thread
mazhelez marked this conversation as resolved.

The `customALGoFiles` setting of a custom template was only applied on the next Update (from `AL-Go-TemplateRepoSettings.doNotEdit.json`). Now the up-to-date settings of the custom template are used directly during "Update AL-Go System Files". The template's `filesToInclude`, `filesToExclude`, and `filesToRemove` settings are merged with the consumer repo's settings before resolution.

- **`filesToInclude`** now also resolves files from the original AL-Go template. Files present in the official template that are not overridden by your custom template are propagated to consumer repos. When a file exists in both, the custom template version takes precedence.
Comment thread
mazhelez marked this conversation as resolved.
Outdated
- **`filesToExclude`** now also resolves files from the original AL-Go template (same dual-resolution as `filesToInclude`). Files resolved by `filesToInclude` whose source matches a `filesToExclude` entry are not copied to consumer repos, and existing copies are removed.
- **`filesToRemove`** (new property): Unconditionally removes matching files from consumer repos. Files are searched in both the template and end repository. Takes precedence over `filesToInclude`. Entries use `sourceFolder` (relative to the template), `filter`, and optionally `destinationFolder` and `perProject`.

Read more at [Customizing AL-Go for GitHub](Scenarios/CustomizingALGoForGitHub.md#Using-custom-template-files).

### Resilient Pull Request Status Check for large builds

The Pull Request Status Check action no longer fails on builds with more than one page of jobs (more than 100 jobs). The jobs API call now uses `--slurp` so multi-page responses are parsed as a single JSON array (previously `gh api --paginate | ConvertFrom-Json` failed with "Invalid JSON primitive" when more than one page was returned). The call is also retried, and requests a smaller page size, to tolerate the intermittent HTTP 502 responses that the GitHub jobs endpoint returns for large builds.
Expand Down
Loading