Files
Gokul faf1af6ff5 fix(validators): reject non-mapping env values in validate (#90)
It turns out that `wrkflw validate` was happily accepting
`env: VAR=value` — a bare string — when GitHub Actions *only*
allows mappings for env. The reason is that the validate path
(evaluate_workflow_file) runs its own structural validators
but never actually checks the type of env fields. The JSON
schema gets it right, but it's only wired up in the parser
path, not the validator.

Add a validate_env() helper that checks env is either a YAML
mapping or an expression string (${{ }}), and wire it into
all three levels: top-level, job-level, and step-level. Tests
included for each.

Closes #89
2026-04-06 22:17:18 +05:30
..

wrkflw-validators

Validation utilities for workflows and steps.

  • Validates GitHub Actions sections: jobs, steps, actions references, triggers
  • GitLab pipeline validation helpers
  • Matrix-specific validation

Example

use serde_yaml::Value;
use wrkflw_models::ValidationResult;
use wrkflw_validators::{validate_jobs, validate_triggers};

let yaml: Value = serde_yaml::from_str(r#"name: demo
on: [workflow_dispatch]
jobs: { build: { runs-on: ubuntu-latest, steps: [] } }
"#).unwrap();

let mut res = ValidationResult::new();
if let Some(on) = yaml.get("on") {
    validate_triggers(on, &mut res);
}
if let Some(jobs) = yaml.get("jobs") {
    validate_jobs(jobs, &mut res);
}
assert!(res.is_valid);