Skip to content

Conversation

spetersenms
Copy link
Contributor

❔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 spetersenms marked this pull request as ready for review August 26, 2025 13:00
@Copilot Copilot AI review requested due to automatic review settings August 26, 2025 13:00
@spetersenms spetersenms requested a review from a team as a code owner August 26, 2025 13:00
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new feature that consolidates the output of selected settings from the ReadSettings action into a single JSON structure, streamlining how workflow outputs are handled. Instead of requiring separate steps to extract individual settings and add them to job outputs, all settings specified in the get parameter are now available in a compressed JSON format through the SelectedSettingsJson output.

  • Adds SelectedSettingsJson output to ReadSettings action containing all selected settings in JSON format
  • Removes dedicated workflow steps for extracting individual settings like DetermineWorkflowDepth and DeterminePowerPlatformSolutionFolder
  • Updates all workflow templates to use the new JSON output format with fromJson() function

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Actions/ReadSettings/ReadSettings.ps1 Implements collection and JSON serialization of selected settings
Actions/ReadSettings/action.yaml Adds SelectedSettingsJson output definition
Actions/ReadSettings/README.md Documents the new SelectedSettingsJson output
Tests/ReadSettings.Action.Test.ps1 Adds comprehensive test coverage for the new JSON output functionality
Templates/.../workflows/*.yaml Updates workflow templates to use new JSON output format and removes redundant steps

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +47 to +48
workflowDepth: ${{ env.workflowDepth }}
powerPlatformSolutionFolder: ${{ fromJson(steps.ReadSettings.outputs.SelectedSettingsJson).powerPlatformSolutionFolder }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can just assign workflowDepth to ${{ env.workflowDepth }} couldn't we do the same for powerPlatformSolutionFolder.

The settings defined in the "get" parameter are already assigned to an environment variable AFAIK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only works for workflowDepth because it's a global environment variable defined on line 23. The environment variables created by readsettings for things in the get param can't be used for job outputs, hence the need for putting everything in "get" into a separate output variable which can then be used for the job output.

That said, it seems the workflowDepth output is not actually used. In this PR I kept it for now, but we can probably remove it completely as the whole workflow should have access to env.workflowDepth given it's defined on the global level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants