Skip to content

Commit

Permalink
Merge branch 'noPAT' of https://github.com/freddydk/AL-Go into noPAT
Browse files Browse the repository at this point in the history
  • Loading branch information
freddydk committed Jan 23, 2025
2 parents ec0c203 + d17fef3 commit b4def6d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
2 changes: 0 additions & 2 deletions Actions/Deliver/Deliver.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Param(
[Parameter(HelpMessage = "The GitHub actor running the action", Mandatory = $false)]
[string] $actor,
[Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)]
[string] $token,
[Parameter(HelpMessage = "Projects to deliver (default is all)", Mandatory = $false)]
Expand Down
1 change: 0 additions & 1 deletion Actions/Deliver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Deliver App to deliveryTarget (AppSource, Storage, or...)
| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
| actor | | The GitHub actor running the action | github.actor |
| token | | The GitHub token running the action | github.token |
| projects | | Comma-separated list of projects to deliver | * |
| deliveryTarget | Yes | Delivery target (AppSource, Storage, GitHubPackages,...) | |
Expand Down
7 changes: 1 addition & 6 deletions Actions/Deliver/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ inputs:
description: Shell in which you want to run the action (powershell or pwsh)
required: false
default: powershell
actor:
description: The GitHub actor running the action
required: false
default: ${{ github.actor }}
token:
description: The GitHub token running the action
required: false
Expand Down Expand Up @@ -41,7 +37,6 @@ runs:
- name: run
shell: ${{ inputs.shell }}
env:
_actor: ${{ inputs.actor }}
_token: ${{ inputs.token }}
_projects: ${{ inputs.projects }}
_deliveryTarget: ${{ inputs.deliveryTarget }}
Expand All @@ -51,7 +46,7 @@ runs:
_goLive: ${{ inputs.goLive }}
run: |
${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "Deliver" -Action {
${{ github.action_path }}/Deliver.ps1 -actor $ENV:_actor -token $ENV:_token -projects $ENV:_projects -deliveryTarget $ENV:_deliveryTarget -artifacts $ENV:_artifacts -type $ENV:_type -atypes $ENV:_atypes -goLive ($ENV:_goLive -eq 'true')
${{ github.action_path }}/Deliver.ps1 -token $ENV:_token -projects $ENV:_projects -deliveryTarget $ENV:_deliveryTarget -artifacts $ENV:_artifacts -type $ENV:_type -atypes $ENV:_atypes -goLive ($ENV:_goLive -eq 'true')
}
branding:
icon: terminal
Expand Down
11 changes: 6 additions & 5 deletions Actions/DetermineDeliveryTargets/DetermineDeliveryTargets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
[bool] $checkContextSecrets
)

function ContinuousDelivery([string] $deliveryTarget) {
function ContinuousDelivery([string] $deliveryTarget, [string[]] $projects) {
$settingsName = "DeliverTo$deliveryTarget"
if ($deliveryTarget -eq 'AppSource' -and $settings.type -eq "AppSource App") {
# For multi-project repositories, ContinuousDelivery can be set on the projects
foreach($project in ($projectsJson | ConvertFrom-Json)) {
foreach($project in $projects) {
$projectSettings = ReadSettings -project $project
if ($projectSettings.deliverToAppSource.ContinuousDelivery -or ($projectSettings.Contains('AppSourceContinuousDelivery') -and $projectSettings.AppSourceContinuousDelivery)) {
Write-Host "Project $project is setup for Continuous Delivery to AppSource"
Expand Down Expand Up @@ -38,7 +38,7 @@ function IncludeBranch([string] $deliveryTarget) {
}
}

function IncludeDeliveryTarget([string] $deliveryTarget) {
function IncludeDeliveryTarget([string] $deliveryTarget, [string[]] $projects) {
Write-Host "DeliveryTarget $_"
# DeliveryTarget Context Secret needs to be specified for a delivery target to be included
$contextName = "$($_)Context"
Expand All @@ -47,7 +47,7 @@ function IncludeDeliveryTarget([string] $deliveryTarget) {
Write-Host "- Secret '$contextName' not found"
return $false
}
return (IncludeBranch -deliveryTarget $deliveryTarget) -and (ContinuousDelivery -deliveryTarget $deliveryTarget)
return (IncludeBranch -deliveryTarget $deliveryTarget) -and (ContinuousDelivery -deliveryTarget $deliveryTarget -projects $projects)
}

. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
Expand All @@ -66,7 +66,8 @@ Get-Item -Path (Join-Path $ENV:GITHUB_WORKSPACE ".github/$($namePrefix)*.ps1") |
$deliveryTargets = @($deliveryTargets | Select-Object -unique)
if ($checkContextSecrets) {
# Check all delivery targets and include only the ones needed
$deliveryTargets = @($deliveryTargets | Where-Object { IncludeDeliveryTarget -deliveryTarget $_ })
$projects = $projectsJson | ConvertFrom-Json
$deliveryTargets = @($deliveryTargets | Where-Object { IncludeDeliveryTarget -deliveryTarget $_ -projects $projects })
}
$contextSecrets = @($deliveryTargets | ForEach-Object { "$($_)Context" })

Expand Down

0 comments on commit b4def6d

Please sign in to comment.