AL-Go icon indicating copy to clipboard operation
AL-Go copied to clipboard

ReadSettings output JSON structured based on get input parameter.

Open spetersenms opened this issue 4 months ago • 0 comments

❔What, Why & How

This feature changes how we handle output variables from ReadSettings. The current solution is to add a setting to the get parameter of ReadSettings, and then add a step like this:

- name: Add Output From Setting
   id: AddOutputFromSetting
   run: |
     Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "SettingName=$($env:settingName)"

This is then added to the outputs of a job like this:

Initialization:
  needs: [ PregateCheck ]
  if: (!failure() && !cancelled())
  runs-on: [ windows-latest ]
  outputs:
    <...>
    SettingName: ${{ steps.AddOutputFromSetting.outputs.SettingName }}
  steps:
    <...>

This new solution takes all settings selected in the get parameter of ReadSettings and puts them in a single JSON structure. This can then be used directly in the job outputs like this:

Initialization:
  needs: [ PregateCheck ]
  if: (!failure() && !cancelled())
  runs-on: [ windows-latest ]
  outputs:
    <...>
    SettingName: ${{ fromJson(steps.ReadSettings.outputs.SelectedSettingsJson).settingName }}
  steps:
    <...>

✅ Checklist

  • [ ] Add tests (E2E, unit tests)
  • [ ] Update RELEASENOTES.md
  • [ ] Update documentation (e.g. for new settings or scenarios)
  • [ ] Add telemetry

spetersenms avatar Aug 25 '25 14:08 spetersenms