CICD-045 · Select a matrix from explicit JSON
Encyclopedia · Matrices and sharding · All snippets
Previous · CICD-044 · Next · CICD-046
1. Where it fits
- Placement Under the matrix consumer job. Declare
needs: planand produce a JSON object namedmatrixfrom the plan job. - Prerequisites workspace whose runtime dependencies match the chosen target combinations.
- Platforms github-actions, gitea-actions.
2. Copy the snippet
yaml
strategy:
matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}3. How it works
fromJSON decodes planner output into the object that strategy.matrix expects. Verify the producer's schema and handle an empty target set before scheduling.
A planner sets the dynamic shape of the downstream jobs.
flowchart TD N1["Planner output"] N2["Decode matrix JSON"] N1 --> N2 N3["First target job"] N2 --> N3 N4["Other target jobs"] N2 --> N4 N5["Aggregate evidence"] N3 --> N5 N4 --> N5
4. Verify the result
Configure needs: plan on the job. A compact JSON object with at least one dimension is required.
Validation syntax-validated (YAML parse). Status definitions.