Skip to main content

templates/yaml-format-utils

Functions

formatIfConditions()

function formatIfConditions(yamlContent, minLength): string;

Defined in: templates/yaml-format-utils.ts:24

Formats long GitHub Actions conditional expressions for better readability. Takes a YAML string and formats multi-line if: conditions with proper indentation.

Parameters

yamlContent

string

The YAML content to format

minLength

number = 80

Minimum length threshold for formatting (default: 80 characters)

Returns

string

Formatted YAML content

Example

Input:
if: ${{ always() && github.event_name != 'pull_request' && needs.test.result == 'success' }}

Output:
if: ${{
always() &&
github.event_name != 'pull_request' &&
needs.test.result == 'success'
}}