generated from microsoft/AL-Go-PTE
-
Notifications
You must be signed in to change notification settings - Fork 5
115 lines (102 loc) · 3.69 KB
/
UpdateGitHubGoSystemFiles.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: ' Update AL-Go System Files'
on:
workflow_dispatch:
inputs:
templateUrl:
description: Template Repository URL (current is https://github.com/microsoft/AL-Go-PTE@main)
required: false
default: ''
downloadLatest:
description: Download latest from template repository
type: boolean
default: true
directCommit:
description: Direct Commit?
type: boolean
default: false
schedule:
- cron: '0 0 1,15 * *'
permissions:
actions: read
contents: read
id-token: write
defaults:
run:
shell: powershell
env:
ALGoOrgSettings: ${{ vars.ALGoOrgSettings }}
ALGoRepoSettings: ${{ vars.ALGoRepoSettings }}
jobs:
UpdateALGoSystemFiles:
name: 'Update AL-Go System Files'
needs: [ ]
runs-on: [ windows-latest ]
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/[email protected]
with:
shell: powershell
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Initialize the workflow
id: init
uses: microsoft/AL-Go-Actions/[email protected]
with:
shell: powershell
- name: Read settings
uses: microsoft/AL-Go-Actions/[email protected]
with:
shell: powershell
get: templateUrl
- name: Read secrets
id: ReadSecrets
uses: microsoft/AL-Go-Actions/[email protected]
with:
shell: powershell
gitHubSecrets: ${{ toJson(secrets) }}
getSecrets: 'ghTokenWorkflow'
- name: Override templateUrl
env:
templateUrl: ${{ github.event.inputs.templateUrl }}
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$templateUrl = $ENV:templateUrl
if ($templateUrl) {
Write-Host "Using Template Url: $templateUrl"
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "templateUrl=$templateUrl"
}
- name: Calculate Input
env:
directCommit: '${{ github.event.inputs.directCommit }}'
downloadLatest: ${{ github.event.inputs.downloadLatest }}
eventName: ${{ github.event_name }}
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$directCommit = $ENV:directCommit
$downloadLatest = $ENV:downloadLatest
Write-Host $ENV:eventName
if ($ENV:eventName -eq 'schedule') {
Write-Host "Running Update AL-Go System Files on a schedule. Setting DirectCommit and DownloadLatest to true"
$directCommit = 'true'
$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: microsoft/AL-Go-Actions/[email protected]
with:
shell: powershell
token: ${{ fromJson(steps.ReadSecrets.outputs.Secrets).ghTokenWorkflow }}
downloadLatest: ${{ env.downloadLatest }}
update: 'Y'
templateUrl: ${{ env.templateUrl }}
directCommit: ${{ env.directCommit }}
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
currentJobContext: ${{ toJson(job) }}