Skip to content

Commit

Permalink
Simplify code to populate matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrzajac committed Oct 19, 2023
1 parent f627ccb commit d5664d8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@ jobs:
AutoNSubstitute=if ('${{inputs.buildAutoNSubstitute}}') { $${{inputs.buildAutoNSubstitute}} } else { $true };
AutoFakeItEasy=if ('${{inputs.buildAutoFakeItEasy}}') { $${{inputs.buildAutoFakeItEasy}} } else { $true }
}
$matrix = @{
package_module = @(Foreach ($module in ($allModules.GetEnumerator() | Where-Object { $_.Value })) {$module.Name})
}
if ($matrix.package_module.count -gt 0) { $matrix.package_module = @("Core") + $matrix.package_module }
$matrix = @(Foreach ($module in ($allModules.GetEnumerator() | Where-Object { $_.Value })) {$module.Name})
if ($matrix.count -gt 0) { $matrix = @("Core") + $matrix }
"MATRIX=$($matrix | ConvertTo-JSON -Compress)" >> $env:GITHUB_OUTPUT
- run: Write-Output "Matrix:${{ steps.set-matrix.outputs.MATRIX }}, MatrixJSON:${{ fromJSON(steps.set-matrix.outputs.MATRIX) }}"
- run: Write-Output "Matrix:${{ steps.set-matrix.outputs.MATRIX }}"
- name: 📥 checkout
uses: actions/checkout@v3
with:
Expand All @@ -90,7 +88,8 @@ jobs:
env:
Version: ${{ needs.init.outputs.Version }}
strategy:
matrix: ${{ fromJSON(needs.init.outputs.matrix) }}
matrix:
package_module: ${{ fromJSON(needs.init.outputs.matrix) }}
steps:
- name: 📥 checkout
uses: actions/checkout@v3
Expand Down

0 comments on commit d5664d8

Please sign in to comment.