diff --git a/Actions/.Modules/ReadSettings.psm1 b/Actions/.Modules/ReadSettings.psm1
index ea3bbe350a..a692baec99 100644
--- a/Actions/.Modules/ReadSettings.psm1
+++ b/Actions/.Modules/ReadSettings.psm1
@@ -226,6 +226,7 @@ function GetDefaultSettings
}
"fullBuildPatterns" = @()
"excludeEnvironments" = @()
+ "noMatchingEnvironmentsAction" = "ignore"
"alDoc" = [ordered]@{
"continuousDeployment" = $false
"deployToGitHubPages" = $true
diff --git a/Actions/.Modules/settings.schema.json b/Actions/.Modules/settings.schema.json
index 2c90ab3b21..eb38acd280 100644
--- a/Actions/.Modules/settings.schema.json
+++ b/Actions/.Modules/settings.schema.json
@@ -590,6 +590,11 @@
},
"description": "An array of environments to be excluded from the build. See https://aka.ms/ALGoSettings#excludeenvironments"
},
+ "noMatchingEnvironmentsAction": {
+ "type": "string",
+ "pattern": "^(ignore|warning|error)$",
+ "description": "Specifies what happens when deployment environments are found but all are excluded by branch policies or deployment type filters. Allowed values are ignore, warning and error. See https://aka.ms/ALGoSettings#nomatchingenvironmentsaction"
+ },
"alDoc": {
"type": "object",
"properties": {
diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1
index 6fc16f99ed..eebd33d7ba 100644
--- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1
+++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1
@@ -270,7 +270,15 @@ else {
}
}
if (!$includeEnvironment) {
- Write-Host "Environment $environmentName is not setup for deployments from branch $ENV:GITHUB_REF_NAME"
+ if ($deploymentSettings.BranchesFromPolicy -and $deploymentSettings.BranchesFromPolicy.Count -gt 0) {
+ Write-Host "Environment $environmentName is not setup for deployments from branch '$($ENV:GITHUB_REF_NAME)' (GitHub policy allows branches: $($deploymentSettings.BranchesFromPolicy -join ', '))"
+ }
+ elseif ($deploymentSettings.Branches -and $deploymentSettings.Branches.Count -gt 0) {
+ Write-Host "Environment $environmentName is not setup for deployments from branch '$($ENV:GITHUB_REF_NAME)' (allowed branches in settings: $($deploymentSettings.Branches -join ', '))"
+ }
+ else {
+ Write-Host "Environment $environmentName is not setup for deployments from branch '$($ENV:GITHUB_REF_NAME)' (no branch policy defined - only 'main' is allowed by default)"
+ }
}
}
if ($includeEnvironment) {
@@ -304,3 +312,18 @@ Write-Host "EnvironmentCount=$($deploymentEnvironments.Keys.Count)"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "UnknownEnvironment=$unknownEnvironment"
Write-Host "UnknownEnvironment=$unknownEnvironment"
+
+# Handle noMatchingEnvironmentsAction when environments were found but all filtered out
+if ($deploymentEnvironments.Keys.Count -eq 0 -and $environments -and @($environments).Count -gt 0) {
+ $noMatchAction = if ($settings.ContainsKey('noMatchingEnvironmentsAction')) { $settings.noMatchingEnvironmentsAction } else { 'ignore' }
+ $message = "No environments matched deployment criteria. $(@($environments).Count) environment(s) were found ($($environments -join ', ')) but all were excluded by branch policies or deployment type filters. Current branch: $ENV:GITHUB_REF_NAME"
+ switch ($noMatchAction) {
+ 'warning' {
+ OutputWarning $message
+ }
+ 'error' {
+ throw $message
+ }
+ # 'ignore' - current behavior, do nothing
+ }
+}
diff --git a/Actions/DumpWorkflowInfo/DumpWorkflowInfo.ps1 b/Actions/DumpWorkflowInfo/DumpWorkflowInfo.ps1
index 555b0e4067..7052236d96 100644
--- a/Actions/DumpWorkflowInfo/DumpWorkflowInfo.ps1
+++ b/Actions/DumpWorkflowInfo/DumpWorkflowInfo.ps1
@@ -1,12 +1,13 @@
-Write-Host "Event name: $env:GITHUB_EVENT_NAME"
-if ($env:GITHUB_EVENT_NAME -eq 'workflow_dispatch') {
- Write-Host "Inputs:"
- $eventPath = Get-Content -Encoding UTF8 -Path $env:GITHUB_EVENT_PATH -Raw | ConvertFrom-Json
- if ($null -ne $eventPath.inputs) {
- $eventPath.inputs.psObject.Properties | Sort-Object { $_.Name } | ForEach-Object {
- $property = $_.Name
- $value = $eventPath.inputs."$property"
- Write-Host "- $property = '$value'"
- }
- }
-}
+Write-Host "Event name: $env:GITHUB_EVENT_NAME"
+Write-Host "Branch: $env:GITHUB_REF_NAME"
+if ($env:GITHUB_EVENT_NAME -eq 'workflow_dispatch') {
+ Write-Host "Inputs:"
+ $eventPath = Get-Content -Encoding UTF8 -Path $env:GITHUB_EVENT_PATH -Raw | ConvertFrom-Json
+ if ($null -ne $eventPath.inputs) {
+ $eventPath.inputs.psObject.Properties | Sort-Object { $_.Name } | ForEach-Object {
+ $property = $_.Name
+ $value = $eventPath.inputs."$property"
+ Write-Host "- $property = '$value'"
+ }
+ }
+}
diff --git a/Scenarios/settings.md b/Scenarios/settings.md
index 6a54b92c42..2d2d6124c3 100644
--- a/Scenarios/settings.md
+++ b/Scenarios/settings.md
@@ -131,6 +131,8 @@ The repository settings are only read from the repository settings file (.github
| assignPremiumPlan | Setting assignPremiumPlan to true in your project setting file, causes the build container to be created with the AssignPremiumPlan set. This causes the auto-created user to have Premium Plan enabled. This setting is needed if your tests require premium plan enabled. | false |
| enableTaskScheduler | Setting enableTaskScheduler to true in your project setting file, causes the build container to be created with the Task Scheduler running. | false |
| useCompilerFolder | Setting useCompilerFolder to true causes your pipelines to use containerless compiling. Unless you also set **doNotPublishApps** to true, setting useCompilerFolder to true won't give you any performance advantage, since AL-Go for GitHub will still need to create a container in order to publish and test the apps. In the future, publishing and testing will be split from building and there will be other options for getting an instance of Business Central for publishing and testing. **Note** when using UseCompilerFolder you need to sign apps using the new signing mechanism described [here](../Scenarios/Codesigning.md). | false |
+| excludeEnvironments | excludeEnvironments can be an array of GitHub Environments, which should be excluded from the list of environments considered for deployment. github-pages is automatically added to this array and cannot be used as environment for deployment of AL-Go for GitHub projects. | [ ] |
+| noMatchingEnvironmentsAction | Specifies what happens when deployment environments are found but all are excluded by branch policies or deployment type filters, resulting in nothing being deployed. Allowed values are **ignore** (workflow succeeds silently, current default behavior), **warning** (workflow succeeds but shows a visible warning annotation), and **error** (workflow fails with a clear error message). | ignore |
| workspaceCompilation | **PREVIEW:** Configuration for workspace compilation. This uses the AL tool to compile all apps in the workspace in a single operation, which can improve build performance for repositories with multiple apps. Like **useCompilerFolder**, this is containerless compiling.
**enabled** - Set to true to enable workspace compilation. Default: false.
**parallelism** - The number of parallel compilation processes. Set to 0 or -1 to use all available processors. Default: 1.
**Current limitations:**