validate_actions.pipeline_stages.validator

Validator coordinating rules and fixer.

Classes

ExtensibleValidator(problems, fixer[, ...])

Validates GitHub Actions workflows by applying a configurable set of rules.

Validator(problems)

Validates GitHub Actions workflows by applying complex checks.

class validate_actions.pipeline_stages.validator.Validator(problems)[source]

Bases: ProcessStage[Workflow, Problems]

Validates GitHub Actions workflows by applying complex checks.

Parameters:

problems (Problems)

abstractmethod process(workflow)[source]

Validate the given workflow and return any problems found.

Parameters:

workflow (Workflow) – The workflow to validate.

Returns:

A Problems object containing any issues found during validation.

Return type:

Problems

class validate_actions.pipeline_stages.validator.ExtensibleValidator(problems, fixer, config_path=None)[source]

Bases: Validator

Validates GitHub Actions workflows by applying a configurable set of rules.

The ExtensibleValidator uses a YAML configuration file to determine which rules to apply, making it easily extensible without code changes. Rules are loaded dynamically using the module:class format.

Example config file (rules/rules.yml):
rules:

expressions-contexts: validate_actions.rules.expressions_contexts:ExpressionsContexts action-metadata: validate_actions.rules.action_metadata:ActionMetadata custom-rule: my_package.rules.custom:MyCustomRule

Usage:

# Use default config validator = ExtensibleValidator(problems, fixer)

# Use custom config validator = ExtensibleValidator(problems, fixer, “/path/to/custom-rules.yml”)

Parameters:
process(workflow)[source]

Validate the given workflow and return any problems found.

Parameters:

workflow (Workflow) – The workflow to validate.

Returns:

A Problems object containing any issues found during validation.

Return type:

Problems