Skip to main content

parse_workflow_yaml

Function parse_workflow_yaml 

pub fn parse_workflow_yaml(
    content: &str,
    uri: &Uri,
) -> Result<GithubActionsParseResult, DepsError>
Expand description

Parses a .github/workflows/*.yml/*.yaml file and returns every uses: dependency found, with LSP position tracking.

Gated first (as deps-dart’s pubspec.yaml parser) by deps_core::check_yaml_nesting_depth/deps_core::check_yaml_expansion, which return a real DepsError::ParseError. A downstream YAML syntax error, by contrast, degrades to an empty GithubActionsParseResult (logged at debug) rather than propagating — workflows are numerous per repository, and one malformed file should not disable hover/ completion for every other open workflow.

§Errors

Returns DepsError::ParseError only when content exceeds the shared YAML nesting-depth or expansion-size gate.

§Examples

use deps_core::Dependency;
use deps_github_actions::parse_workflow_yaml;

let content = "steps:\n  - uses: actions/checkout@v4\n";
let uri = deps_core::test_util::test_uri("/repo/.github/workflows/ci.yml");
let result = parse_workflow_yaml(content, &uri).unwrap();

assert_eq!(result.dependencies.len(), 1);
assert_eq!(result.dependencies[0].name(), "actions/checkout");