You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: AL-Go-TestRepoHelper.ps1
+25-7
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,23 @@ function Test-Shell {
43
43
}
44
44
}
45
45
46
+
functionTest-Deprecations {
47
+
Param(
48
+
[HashTable] $json,
49
+
[string] $settingsDescription
50
+
)
51
+
52
+
# cleanModePreprocessorSymbols is deprecated
53
+
if ($json.Keys-contains'cleanModePreprocessorSymbols') {
54
+
OutputWarning -Message "cleanModePreprocessorSymbols in $settingsDescription is deprecated. See https://aka.ms/algodeprecations#cleanModePreprocessorSymbols"
OutputWarning -Message "$_ in $settingsDescription is deprecated. See https://aka.ms/algodeprecations#_workflow_Schedule. This warning will become an error in the future."
throw"Failed to update AL-Go System Files. Make sure that the personal access token, defined in the secret called GhTokenWorkflow, is not expired and it has permission to update workflows. (Error was $($_.Exception.Message))"
throw"Failed to update AL-Go System Files. Make sure that the personal access token, defined in the secret called GhTokenWorkflow, is not expired and it has permission to update workflows. (Error was $($_.Exception.Message))"
if ($repoSettings.Keys-contains$key-and ($repoSettings."$key")) {
318
+
throw"The $key setting is not allowed in the global repository settings. Please use the workflow specific settings file or conditional settings."
319
+
}
320
+
}
297
321
298
-
# Any workflow (except for the PullRequestHandler and reusable workflows (_*)) can have a RepoSetting called <workflowname>Schedule, which will be used to set the schedule for the workflow
322
+
# Re-read settings and this time include workflow specific settings
# Old Schedule key is deprecated, but still supported
326
+
$oldWorkflowScheduleKey="$($baseName)Schedule"
327
+
if ($repoSettings.Keys-contains$oldWorkflowScheduleKey) {
328
+
# DEPRECATION: REPLACE WITH ERROR AFTER October 1st 2025 --->
329
+
if ($repoSettings.Keys-contains$workflowScheduleKey) {
330
+
OutputWarning "Both $oldWorkflowScheduleKey and $workflowScheduleKey are defined in the settings file. $oldWorkflowScheduleKey will be ignored. This warning will become an error in the future"
331
+
}
332
+
else {
333
+
Trace-DeprecationWarning-Message "$oldWorkflowScheduleKey is deprecated"-DeprecationTag "_workflow_Schedule"-WillBecomeError
334
+
# Convert the old <workflow>Schedule setting to the new WorkflowSchedule setting
# ContainerHelper is used for determining project folders and dependencies
23
24
DownloadAndImportBcContainerHelper
24
25
25
-
if ($update-eq'Y') {
26
-
if (-not$token) {
27
-
throw"A personal access token with permissions to modify Workflows is needed. You must add a secret called GhTokenWorkflow containing a personal access token. You can Generate a new token from https://github.com/settings/tokens. Make sure that the workflow scope is checked."
# Use Authenticated API request if possible to avoid the 60 API calls per hour limit
57
+
$headers= GetHeaders -token $readToken
58
+
51
59
# CheckForUpdates will read all AL-Go System files from the Template repository and compare them to the ones in the current repository
52
60
# CheckForUpdates will apply changes to the AL-Go System files based on AL-Go repo settings, such as "runs-on" etc.
53
61
# if $update is set to Y, CheckForUpdates will also update the AL-Go System files in the current repository using a PR or a direct commit (if $directCommit is set to true)
54
62
# if $update is set to N, CheckForUpdates will only check for updates and output a warning if there are updates available
55
63
# 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
56
64
57
65
# Get Repo settings as a hashtable (do NOT read any specific project settings, nor any specific workflow, user or branch settings)
if (!(CommitFromNewFolder -serverUrl $serverUrl-commitMessage $commitMessage-branch $branch-body $releaseNotes)) {
273
+
if (!(CommitFromNewFolder -serverUrl $serverUrl-commitMessage $commitMessage-branch $branch-body $releaseNotes-headBranch $updateBranch)) {
261
274
OutputNotice -message "No updates available for AL-Go for GitHub."
262
275
}
263
276
}
264
277
catch {
265
278
if ($directCommit) {
266
-
throw"Failed to update AL-Go System Files. Make sure that the personal access token, defined in the secret called GhTokenWorkflow, is not expired and it has permission to update workflows. (Error was $($_.Exception.Message))"
279
+
throw"Failed to update AL-Go System Files. Make sure that the personal access token, defined in the secret called GhTokenWorkflow, is not expired and it has permission to update workflows. Read https://github.com/microsoft/AL-Go/blob/main/Scenarios/GhTokenWorkflow.md for more information. (Error was $($_.Exception.Message))"
267
280
}
268
281
else {
269
-
throw"Failed to create a pull-request to AL-Go System Files. Make sure that the personal access token, defined in the secret called GhTokenWorkflow, is not expired and it has permission to update workflows. (Error was $($_.Exception.Message))"
282
+
throw"Failed to create a pull-request to AL-Go System Files. Make sure that the personal access token, defined in the secret called GhTokenWorkflow, is not expired and it has permission to update workflows. Read https://github.com/microsoft/AL-Go/blob/main/Scenarios/GhTokenWorkflow.md for more information. (Error was $($_.Exception.Message))"
0 commit comments