Skip to content

Update AL-Go System Files #1229

Update AL-Go System Files

Update AL-Go System Files #1229

name: ' Update AL-Go System Files'
on:
workflow_dispatch:
inputs:
templateUrl:
description: Template Repository URL (current is https://github.com/mazhelez/AL-Go@update-al-go-multiple-branches)
required: false
default: ''
downloadLatest:
description: Download latest from template repository
type: boolean
default: true
directCommit:
description: Direct Commit?
type: boolean
default: false
includeBranches:
description: Specify a comma-separated list of branches to update. Wildcards are supported. The AL-Go settings will be read for every branch. Leave empty to update the current branch only.
required: false
default: ''
schedule:
- cron: '39 16 * * *'
permissions:
actions: read
contents: read
id-token: write
defaults:
run:
shell: pwsh
env:
ALGoOrgSettings: ${{ vars.ALGoOrgSettings }}
ALGoRepoSettings: ${{ vars.ALGoRepoSettings }}
jobs:
Initialize:
runs-on: windows-latest
name: Initialize
outputs:
UpdateBranches: ${{ steps.GetBranches.outputs.Result }}
TemplateUrl: ${{ steps.DetermineTemplateUrl.outputs.TemplateUrl }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Read settings
id: ReadSettings
uses: mazhelez/AL-Go/Actions/ReadSettings@update-al-go-multiple-branches
with:
shell: pwsh
get: templateUrl
- name: Get Workflow Multi-Run Branches
id: GetBranches
uses: mazhelez/AL-Go/Actions/GetWorkflowMultiRunBranches@update-al-go-multiple-branches
with:
shell: pwsh
includeBranches: ${{ github.event.inputs.includeBranches }}
- name: Determine Template URL
id: DetermineTemplateUrl
shell: pwsh
run: |
$templateUrl = $env:templateUrl # Available from ReadSettings step
$templateUrlAsInput = '${{ github.event.inputs.templateUrl }}'
if ($templateUrlAsInput) {
# Use the input value if it is provided
$templateUrl = $templateUrlAsInput
}
Write-Host "Using template URL: $templateUrl"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "TemplateUrl=$templateUrl"
UpdateALGoSystemFiles:
name: "[${{ matrix.branch }}] Update AL-Go System Files"
environment: Official-Build
needs: [ Initialize ]
runs-on: [ ubuntu-latest ]
strategy:
matrix:
branch: ${{ fromJson(needs.Initialize.outputs.UpdateBranches).branches }}
fail-fast: false
steps:
- name: Dump Workflow Information
uses: mazhelez/AL-Go/Actions/DumpWorkflowInfo@update-al-go-multiple-branches
with:
shell: pwsh
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ matrix.branch }}
- name: Initialize the workflow
id: init
uses: mazhelez/AL-Go/Actions/WorkflowInitialize@update-al-go-multiple-branches
with:
shell: pwsh
- name: Read settings
uses: mazhelez/AL-Go/Actions/ReadSettings@update-al-go-multiple-branches
with:
shell: pwsh
get: commitOptions
- name: Read secrets
id: ReadSecrets
uses: mazhelez/AL-Go/Actions/ReadSecrets@update-al-go-multiple-branches
with:
shell: pwsh
gitHubSecrets: ${{ toJson(secrets) }}
getSecrets: 'ghTokenWorkflow'
- name: Calculate Commit Options
env:
directCommit: '${{ github.event.inputs.directCommit }}'
downloadLatest: '${{ github.event.inputs.downloadLatest }}'
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
if('${{ github.event_name }}' -eq 'workflow_dispatch') {
Write-Host "Using inputs from workflow_dispatch event"
$directCommit = $env:directCommit
$downloadLatest = $env:downloadLatest
}
else {
Write-Host "Using inputs from commitOptions setting"
$commitOptions = $env:commitOptions | ConvertFrom-Json # Available from ReadSettings step
$directCommit=$(-not $commitOptions.createPullRequest)
$downloadLatest=$true
}
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "directCommit=$directCommit"
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "downloadLatest=$downloadLatest"
- name: Update AL-Go system files
uses: mazhelez/AL-Go/Actions/CheckForUpdates@update-al-go-multiple-branches
with:
shell: pwsh
token: ${{ fromJson(steps.ReadSecrets.outputs.Secrets).ghTokenWorkflow }}
downloadLatest: ${{ env.downloadLatest }}
update: 'Y'
templateUrl: ${{ needs.Initialize.outputs.TemplateUrl }}
directCommit: ${{ env.directCommit }}
updateBranch: ${{ matrix.branch }}
- name: Finalize the workflow
if: always()
uses: mazhelez/AL-Go/Actions/WorkflowPostProcess@update-al-go-multiple-branches
env:
GITHUB_TOKEN: ${{ github.token }}
with:
shell: pwsh
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
currentJobContext: ${{ toJson(job) }}