Files
wrkflw/crates/validators
bahdotsh 422a035c40 test: add tests for review fixes and clean up dead code
The previous commit fixed a bunch of bugs but left a few loose
ends. The next_job() function still had a redundant bounds check
that previous_job() already had cleaned up — the .filter() call
makes the inner `if workflow_idx >= self.workflows.len()` dead
code. Let's not leave half-finished refactors lying around.

While at it, add tests for the three behavioral changes that
*really* should have had tests from the start: emulation runtime
returning Ok on non-zero exit codes, log processor not panicking
on multi-byte UTF-8 near bracket boundaries, and step validator
correctly rejecting steps with only a name field.

Also fix formatting (cargo fmt) and a clippy warning about items
defined after the test module.
2026-04-01 19:08:44 +05:30
..
2025-09-05 08:22:15 +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);