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
Add trigger 'workflow_call' to workflow 'UpdateGitHubGoSystemFiles' for reusability (#2031)
### ❔What, Why & How
What:
This change enables the update workflow to be called by other workflows
as a reusable workflow.
Why:
Creating the second (or subsequent) project using one of the app
creation workflows results in an incorrect “.AL-Go” directory in the
created project.
This creates an even bigger problem for our custom template, as our
template contains additional files that are missing from the “.AL-Go”
directories of new projects.
As discussed in #1855, there should be an actual solution that requires
a revision of the current logic for changing and committing files.
In the short term, however, we want to call the update workflow from a
custom job in each app creation workflow.
Related to issue: #1855
### ✅ Checklist
- [x] Add/Update unit tests
- [x] Update RELEASENOTES.md
- [x] Update documentation
---------
Co-authored-by: Ole Wunschmenn <owunschmann4046@cosmoconsult.com>
Co-authored-by: Maria Zhelezova <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
# Validate that the value type matches the input type
357
-
$validationError=$null
358
-
if ($inputType) {
359
-
switch ($inputType) {
360
-
'boolean' {
361
-
if ($defaultValue-isnot [bool]) {
362
-
$validationError="Workflow '$workflowName', input '$inputName': Expected boolean value, but got $($defaultValue.GetType().Name). Please use `$true or `$false."
363
-
}
394
+
# Validate that the value type matches the input type
395
+
$validationError=$null
396
+
if ($inputType) {
397
+
switch ($inputType) {
398
+
'boolean' {
399
+
if ($defaultValue-isnot [bool]) {
400
+
$validationError="Workflow '$workflowName', input '$inputName': Expected boolean value, but got $($defaultValue.GetType().Name). Please use `$true or `$false."
364
401
}
365
-
'number' {
366
-
if ($defaultValue-isnot [int] -and$defaultValue-isnot [long] -and$defaultValue-isnot [double]) {
367
-
$validationError="Workflow '$workflowName', input '$inputName': Expected number value, but got $($defaultValue.GetType().Name)."
368
-
}
402
+
}
403
+
'number' {
404
+
if ($defaultValue-isnot [int] -and$defaultValue-isnot [long] -and$defaultValue-isnot [double]) {
405
+
$validationError="Workflow '$workflowName', input '$inputName': Expected number value, but got $($defaultValue.GetType().Name)."
369
406
}
370
-
'string' {
371
-
if ($defaultValue-isnot [string]) {
372
-
$validationError="Workflow '$workflowName', input '$inputName': Expected string value, but got $($defaultValue.GetType().Name)."
373
-
}
407
+
}
408
+
'string' {
409
+
if ($defaultValue-isnot [string]) {
410
+
$validationError="Workflow '$workflowName', input '$inputName': Expected string value, but got $($defaultValue.GetType().Name)."
374
411
}
375
-
'choice' {
376
-
# Choice inputs accept strings and must match one of the available options (case-sensitive)
377
-
if ($defaultValue-isnot [string]) {
378
-
$validationError="Workflow '$workflowName', input '$inputName': Expected string value for choice input, but got $($defaultValue.GetType().Name)."
379
-
}
380
-
else {
381
-
# Validate that the value is one of the available options
382
-
$optionsStart=0
383
-
$optionsCount=0
384
-
if ($inputSection.Find('options:', [ref] $optionsStart, [ref] $optionsCount)) {
385
-
$availableOptions=@()
386
-
# Parse the options from the YAML (they are indented list items starting with "- ")
387
-
for ($i=$optionsStart+1; $i-lt ($optionsStart+$optionsCount); $i++) {
388
-
$optionLine=$inputSection.content[$i].Trim()
389
-
if ($optionLine-match'^-\s*(.+)$') {
390
-
$availableOptions+=$matches[1].Trim()
391
-
}
412
+
}
413
+
'choice' {
414
+
# Choice inputs accept strings and must match one of the available options (case-sensitive)
415
+
if ($defaultValue-isnot [string]) {
416
+
$validationError="Workflow '$workflowName', input '$inputName': Expected string value for choice input, but got $($defaultValue.GetType().Name)."
417
+
}
418
+
else {
419
+
# Validate that the value is one of the available options
420
+
$optionsStart=0
421
+
$optionsCount=0
422
+
if ($inputSection.Find('options:', [ref] $optionsStart, [ref] $optionsCount)) {
423
+
$availableOptions=@()
424
+
# Parse the options from the YAML (they are indented list items starting with "- ")
425
+
for ($i=$optionsStart+1; $i-lt ($optionsStart+$optionsCount); $i++) {
426
+
$optionLine=$inputSection.content[$i].Trim()
427
+
if ($optionLine-match'^-\s*(.+)$') {
428
+
$availableOptions+=$matches[1].Trim()
392
429
}
430
+
}
393
431
394
-
if ($availableOptions.Count-gt0-and$availableOptions-cnotcontains$defaultValue) {
395
-
$validationError="Workflow '$workflowName', input '$inputName': Value '$defaultValue' is not a valid choice (case-sensitive match required). Available options: $($availableOptions-join', ')."
396
-
}
432
+
if ($availableOptions.Count-gt0-and$availableOptions-cnotcontains$defaultValue) {
433
+
$validationError="Workflow '$workflowName', input '$inputName': Value '$defaultValue' is not a valid choice (case-sensitive match required). Available options: $($availableOptions-join', ')."
397
434
}
398
435
}
399
436
}
400
437
}
401
438
}
402
-
else {
403
-
# If no type is specified in the workflow, it defaults to string
404
-
if ($defaultValue-isnot [string]) {
405
-
OutputWarning "Workflow '$workflowName', input '$inputName': No type specified in workflow (defaults to string), but configured value is $($defaultValue.GetType().Name). This may cause issues."
406
-
}
439
+
}
440
+
else {
441
+
# If no type is specified in the workflow, it defaults to string
442
+
if ($defaultValue-isnot [string]) {
443
+
OutputWarning "Workflow '$workflowName', input '$inputName': No type specified in workflow (defaults to string), but configured value is $($defaultValue.GetType().Name). This may cause issues."
407
444
}
445
+
}
408
446
409
-
if ($validationError) {
410
-
throw$validationError
411
-
}
447
+
if ($validationError) {
448
+
throw$validationError
449
+
}
412
450
413
-
# Convert the default value to the appropriate YAML format
414
-
$yamlValue=$defaultValue
415
-
if ($defaultValue-is [bool]) {
416
-
$yamlValue=$defaultValue.ToString().ToLower()
417
-
}
418
-
elseif ($defaultValue-is [string]) {
419
-
# Quote strings and escape single quotes per YAML spec
420
-
$escapedValue=$defaultValue.Replace("'","''")
421
-
$yamlValue="'$escapedValue'"
422
-
}
451
+
# Convert the default value to the appropriate YAML format
452
+
$yamlValue=$defaultValue
453
+
if ($defaultValue-is [bool]) {
454
+
$yamlValue=$defaultValue.ToString().ToLower()
455
+
}
456
+
elseif ($defaultValue-is [string]) {
457
+
# Quote strings and escape single quotes per YAML spec
458
+
$escapedValue=$defaultValue.Replace("'","''")
459
+
$yamlValue="'$escapedValue'"
460
+
}
423
461
424
-
# Find and replace the default: line in the input section
425
-
$start=0
426
-
$count=0
427
-
if ($inputSection.Find('default:', [ref] $start, [ref] $count)) {
0 commit comments