Skip to main content

utils/workflow-semantics

Workflow Semantic Validation

Validates the semantic correctness of generated GitHub Actions workflows. This includes:

  • Job dependency validation (no circular dependencies)
  • Missing job reference detection
  • Output reference validation
  • Unreachable job detection

Interfaces

SemanticError

Defined in: utils/workflow-semantics.ts:16

Properties

code
code: string;

Defined in: utils/workflow-semantics.ts:18

location?
optional location: string;

Defined in: utils/workflow-semantics.ts:20

message
message: string;

Defined in: utils/workflow-semantics.ts:19

type
type: "error";

Defined in: utils/workflow-semantics.ts:17


SemanticValidationResult

Defined in: utils/workflow-semantics.ts:30

Properties

errors
errors: SemanticError[];

Defined in: utils/workflow-semantics.ts:32

valid
valid: boolean;

Defined in: utils/workflow-semantics.ts:31

warnings
warnings: SemanticWarning[];

Defined in: utils/workflow-semantics.ts:33


SemanticWarning

Defined in: utils/workflow-semantics.ts:23

Properties

code
code: string;

Defined in: utils/workflow-semantics.ts:25

location?
optional location: string;

Defined in: utils/workflow-semantics.ts:27

message
message: string;

Defined in: utils/workflow-semantics.ts:26

type
type: "warning";

Defined in: utils/workflow-semantics.ts:24

Functions

validateJobDependencies()

function validateJobDependencies(yamlContent): SemanticValidationResult;

Defined in: utils/workflow-semantics.ts:259

Validate job dependencies in a workflow.

Checks for:

  1. Circular dependencies between jobs
  2. Missing job references in needs arrays
  3. Invalid output references
  4. Unreachable jobs (warning)

Parameters

yamlContent

string

The workflow YAML content as a string

Returns

SemanticValidationResult

Validation result with errors and warnings

Example

const result = validateJobDependencies(workflowYaml)
if (!result.valid) {
console.error('Validation errors:', result.errors)
}

validateWorkflowSemantics()

function validateWorkflowSemantics(yamlContent): SemanticValidationResult;

Defined in: utils/workflow-semantics.ts:295

Validate a complete workflow for semantic correctness.

This is the main entry point for workflow validation. It combines job dependency validation with other semantic checks.

Parameters

yamlContent

string

The workflow YAML content as a string

Returns

SemanticValidationResult

Validation result with errors and warnings