Skip to main content

processMatrixForExpansion() function

Validates and processes a matrix object for template expansion.

Signature

export declare function processMatrixForExpansion(input: {
matrix: JsonTemplateMatrix;
templateName: string;
templateType: 'action' | 'buildConfiguration';
engine: LiquidEngine;
substitutionsVariables: LiquidSubstitutionsVariables;
log: Logger;
}): Promise<ProcessedMatrix>;

Parameters

Parameter

Type

Description

{ matrix, templateName, templateType, engine, substitutionsVariables, log, }

(not declared)

input

{ matrix: JsonTemplateMatrix; templateName: string; templateType: 'action' | 'buildConfiguration'; engine: LiquidEngine; substitutionsVariables: LiquidSubstitutionsVariables; log: Logger; }

Returns

Promise<ProcessedMatrix>

The processed matrix keys and values.

Exceptions

ConfigurationError If the matrix structure is invalid or substitution fails.

Remarks

This function extracts common matrix processing logic used by both actions and build configurations template expansion. It validates the matrix structure, performs Liquid substitutions on matrix values if needed, and prepares the data for Cartesian product generation.

Processing steps:

  1. Validates that each matrix property is an array of strings.
  2. For each matrix parameter:
    • Collects the parameter name (key).
    • Joins array values with line breaks for substitution.
    • If values contain Liquid syntax, performs substitutions.
    • Splits the result back into individual values.
  3. Returns processed matrix keys and values ready for combination generation.

Matrix value substitution enables dynamic matrix generation where matrix values themselves can reference other substitution variables, enabling flexible configuration without hardcoding platform-specific or environment-specific values.


Generated via tsdoc2docusaurus 1.3.2 by API Extractor/Documenter 7.57.2.