validate_actions.domain_model.ast¶
Abstract Syntax Tree (AST) models for GitHub Actions workflows.
This module defines the domain model for GitHub Actions workflows, providing a structured representation of workflow files that enables validation, analysis, and manipulation. The AST nodes preserve position information for accurate error reporting and auto-fixing.
The AST hierarchy mirrors GitHub Actions workflow structure: - Workflow (root) -> Jobs -> Steps -> Actions/Commands - Events define workflow triggers - Contexts provide runtime data access - Permissions control repository access
All AST nodes use PyYAML token-level parsing to maintain precise position tracking.
Classes
|
Metadata about a GitHub Action for validation. |
|
Event with branch filtering capabilities. |
|
Workflow concurrency control configuration. |
|
Container configuration for job execution. |
|
Authentication credentials for private container registries. |
|
Default settings for run steps. |
|
Environment variables container with convenient access methods. |
|
Deployment environment configuration. |
|
Base class for all workflow trigger events. |
|
Abstract base class for step execution types. |
|
Step that executes a GitHub Action. |
|
Step that executes shell commands. |
|
Individual job within a workflow. |
|
Event with branch and path filtering. |
|
GitHub repository permission levels. |
|
Repository permissions configuration for GITHUB_TOKEN. |
|
Runner selection configuration for jobs. |
|
Scheduled workflow trigger using cron syntax. |
|
Secret configuration for reusable workflow calls. |
|
Supported shell types for run steps. |
|
Individual step within a job. |
|
Job execution strategy with matrix and parallelism controls. |
|
Event with comprehensive filtering options. |
|
Root AST node representing a complete GitHub Actions workflow. |
|
Event for reusable workflow calls. |
|
Typed input parameter for reusable workflows. |
|
Output value definition for reusable workflows. |
|
Secret parameter for reusable workflows. |
|
Supported input types for reusable workflow calls. |
|
Manual workflow trigger with optional inputs. |
|
User input for manual workflow dispatch. |
|
Supported input types for manual workflow dispatch. |
|
Base class for workflow input parameters. |
|
Event triggered by other workflow completions. |
- class validate_actions.domain_model.ast.Workflow(on_, jobs_, contexts, name_=None, run_name_=None, permissions_=<factory>, env_=None, defaults_=None, concurrency_=None)[source]¶
Bases:
objectRoot AST node representing a complete GitHub Actions workflow.
Contains all workflow-level configuration including events, jobs, and global settings. Each workflow maintains its own context scope for expression validation.
- Parameters:
on_ (List[Event])
contexts (Contexts)
name_ (str | None)
run_name_ (str | None)
permissions_ (Permissions)
env_ (Env | None)
defaults_ (Defaults | None)
concurrency_ (Concurrency | None)
- name_¶
Optional display name for the workflow
- Type:
str | None
- run_name_¶
Optional dynamic run name expression
- Type:
str | None
- permissions_¶
Repository permissions for GITHUB_TOKEN
- Type:
- concurrency_¶
Workflow concurrency controls
- Type:
Concurrency | None
- class validate_actions.domain_model.ast.Permission(*values)[source]¶
Bases:
EnumGitHub repository permission levels.
Defines the access level granted to the GITHUB_TOKEN for repository operations.
- class validate_actions.domain_model.ast.Permissions(actions_=Permission(), attestations_=Permission(), checks_=Permission(), contents_=Permission(), deployments_=Permission(), id_token_=Permission(), issues_=Permission(), metadata_=Permission(), models_=Permission(), discussions_=Permission(), packages_=Permission(), pages_=Permission(), pull_requests_=Permission(), security_events_=Permission(), statuses_=Permission())[source]¶
Bases:
objectRepository permissions configuration for GITHUB_TOKEN.
Defines fine-grained permissions for different repository scopes. Default values are permissive to match GitHub’s behavior.
- Parameters:
actions_ (Permission)
attestations_ (Permission)
checks_ (Permission)
contents_ (Permission)
deployments_ (Permission)
id_token_ (Permission)
issues_ (Permission)
metadata_ (Permission)
models_ (Permission)
discussions_ (Permission)
packages_ (Permission)
pages_ (Permission)
pull_requests_ (Permission)
security_events_ (Permission)
statuses_ (Permission)
- actions_¶
Permissions for GitHub Actions
- Type:
- attestations_¶
Permissions for attestations
- Type:
- checks_¶
Permissions for checks API
- Type:
- contents_¶
Permissions for repository contents
- Type:
- deployments_¶
Permissions for deployments
- Type:
- id_token_¶
Permissions for ID token generation
- Type:
- issues_¶
Permissions for issues API
- Type:
- metadata_¶
Permissions for repository metadata
- Type:
- models_¶
Permissions for repository models (e.g. code scanning)
- Type:
- discussions_¶
Permissions for discussions API
- Type:
- packages_¶
Permissions for package registry
- Type:
- pages_¶
Permissions for GitHub Pages
- Type:
- pull_requests_¶
Permissions for pull requests API
- Type:
- security_events_¶
Permissions for security events
- Type:
- statuses_¶
Permissions for commit statuses
- Type:
- class validate_actions.domain_model.ast.Shell(*values)[source]¶
Bases:
EnumSupported shell types for run steps.
Maps to GitHub Actions runner shell options.
- class validate_actions.domain_model.ast.Defaults(pos, shell_=None, working_directory_=None)[source]¶
Bases:
objectDefault settings for run steps.
Provides workflow-level defaults that can be overridden at job or step level.
- class validate_actions.domain_model.ast.Env(variables)[source]¶
Bases:
objectEnvironment variables container with convenient access methods.
Stores environment variables as String objects to preserve position information. Provides dict-like access for easy variable lookup.
- class validate_actions.domain_model.ast.Concurrency(pos, group_, cancel_in_progress_=None)[source]¶
Bases:
objectWorkflow concurrency control configuration.
Manages concurrent execution of workflow runs to prevent conflicts.
- class validate_actions.domain_model.ast.Event(*, id, types_=None)[source]¶
Bases:
objectBase class for all workflow trigger events.
Events define when workflows should execute. Each event type supports different configuration options and filtering capabilities.
- class validate_actions.domain_model.ast.BranchesFilterEvent(*, id, types_=None, branches_=None, branches_ignore_=None)[source]¶
Bases:
EventEvent with branch filtering capabilities.
Base for events that can be filtered by branch names using glob patterns.
- Parameters:
- class validate_actions.domain_model.ast.PathsBranchesFilterEvent(paths_=None, paths_ignore_=None, *, id, types_=None, branches_=None, branches_ignore_=None)[source]¶
Bases:
BranchesFilterEventEvent with branch and path filtering.
Extends branch filtering with file path pattern matching.
- Parameters:
- class validate_actions.domain_model.ast.TagsPathsBranchesFilterEvent(paths_=None, paths_ignore_=None, tags_=None, tags_ignore_=None, *, id, types_=None, branches_=None, branches_ignore_=None)[source]¶
Bases:
PathsBranchesFilterEventEvent with comprehensive filtering options.
Supports filtering by branches, paths, and git tags.
- Parameters:
- class validate_actions.domain_model.ast.ScheduleEvent(cron_, *, id, types_=None)[source]¶
Bases:
EventScheduled workflow trigger using cron syntax.
Enables time-based workflow execution with cron expressions.
- class validate_actions.domain_model.ast.WorkflowInput(id, description_=None, default_=None, required_=False)[source]¶
Bases:
ABCBase class for workflow input parameters.
Defines common properties for inputs to reusable workflows.
- required_¶
Whether input is mandatory
- Type:
bool
- class validate_actions.domain_model.ast.WorkflowCallEvent(inputs_=None, outputs_=None, secrets_=None, *, id, types_=None)[source]¶
Bases:
EventEvent for reusable workflow calls.
Defines interface for workflows that can be called by other workflows.
- Parameters:
inputs_ (List[WorkflowCallEventInput] | None)
outputs_ (List[WorkflowCallEventOutput] | None)
secrets_ (List[WorkflowCallEventSecret] | None)
id (String)
types_ (List[String] | None)
- inputs_¶
Input parameters accepted by this workflow
- Type:
List[WorkflowCallEventInput] | None
- outputs_¶
Output values provided by this workflow
- Type:
List[WorkflowCallEventOutput] | None
- secrets_¶
Secret parameters required by this workflow
- Type:
List[WorkflowCallEventSecret] | None
- class validate_actions.domain_model.ast.WorkflowCallInputType(*values)[source]¶
Bases:
EnumSupported input types for reusable workflow calls.
- class validate_actions.domain_model.ast.WorkflowCallEventInput(id, description_=None, default_=None, required_=False, *, type_)[source]¶
Bases:
WorkflowInputTyped input parameter for reusable workflows.
- Parameters:
id (String)
description_ (String | None)
default_ (String | None)
required_ (bool)
type_ (WorkflowCallInputType)
- type_¶
Data type constraint for the input value
- Type:
- class validate_actions.domain_model.ast.WorkflowCallEventOutput(id, value_, description_=None)[source]¶
Bases:
objectOutput value definition for reusable workflows.
- class validate_actions.domain_model.ast.WorkflowCallEventSecret(id, description_=None, required_=False)[source]¶
Bases:
objectSecret parameter for reusable workflows.
- required_¶
Whether secret must be provided
- Type:
bool
- class validate_actions.domain_model.ast.WorkflowRunEvent(*, id, types_=None, branches_=None, branches_ignore_=None, workflows_)[source]¶
Bases:
BranchesFilterEventEvent triggered by other workflow completions.
- Parameters:
- class validate_actions.domain_model.ast.WorkflowDispatchEvent(inputs_=None, *, id, types_=None)[source]¶
Bases:
EventManual workflow trigger with optional inputs.
Enables manual workflow execution through GitHub UI or API.
- Parameters:
inputs_ (List[WorkflowDispatchEventInput] | None)
id (String)
types_ (List[String] | None)
- inputs_¶
User-configurable input parameters
- Type:
List[WorkflowDispatchEventInput] | None
- class validate_actions.domain_model.ast.WorkflowDispatchInputType(*values)[source]¶
Bases:
EnumSupported input types for manual workflow dispatch.
- class validate_actions.domain_model.ast.WorkflowDispatchEventInput(id, description_=None, default_=None, required_=False, *, type_, options_=None)[source]¶
Bases:
WorkflowInputUser input for manual workflow dispatch.
- Parameters:
id (String)
description_ (String | None)
default_ (String | None)
required_ (bool)
type_ (WorkflowDispatchInputType)
options_ (List[String] | None)
- type_¶
Input type determining UI widget
- class validate_actions.domain_model.ast.RunsOn(pos, labels=<factory>, group=<factory>)[source]¶
Bases:
objectRunner selection configuration for jobs.
Specifies which GitHub Actions runners should execute the job. Supports both individual labels and runner groups.
- class validate_actions.domain_model.ast.Strategy(pos, combinations, fail_fast_, max_parallel_)[source]¶
Bases:
objectJob execution strategy with matrix and parallelism controls.
Defines how jobs should be executed across different configurations.
- Parameters:
- fail_fast_¶
Whether to cancel remaining jobs on first failure
- Type:
bool | None
- max_parallel_¶
Maximum number of concurrent job instances
- Type:
int | None
- class validate_actions.domain_model.ast.Environment(pos, name_, url_=None)[source]¶
Bases:
objectDeployment environment configuration.
Links jobs to GitHub deployment environments for additional controls.
- class validate_actions.domain_model.ast.ContainerCredentials(pos, username_, password_)[source]¶
Bases:
objectAuthentication credentials for private container registries.
- class validate_actions.domain_model.ast.Container(pos, image_, credentials_=None, env_=None, ports_=None, volumes_=None, options_=None)[source]¶
Bases:
objectContainer configuration for job execution.
Enables running jobs inside Docker containers for consistent environments.
- Parameters:
- credentials_¶
Optional registry authentication
- Type:
ContainerCredentials | None
- class validate_actions.domain_model.ast.Secrets(pos, inherit=False, secrets=<factory>)[source]¶
Bases:
objectSecret configuration for reusable workflow calls.
Manages how secrets are passed to called workflows.
- inherit¶
Whether to inherit all secrets from calling workflow
- Type:
bool
- class validate_actions.domain_model.ast.Job(pos, job_id_, steps_, contexts, name_=None, permissions_=<factory>, needs_=None, if_=None, runs_on_=None, environment_=None, concurrency_=None, outputs_=None, env_=None, defaults_=None, timeout_minutes_=None, strategy_=None, container_=None, services_=None, uses_=None, with_=<factory>, secrets_=None)[source]¶
Bases:
objectIndividual job within a workflow.
Jobs are the main execution units that run on specific runners. They contain steps and can depend on other jobs.
- Parameters:
pos (Pos)
job_id_ (str)
steps_ (List[Step])
contexts (Contexts)
name_ (String | None)
permissions_ (Permissions)
needs_ (List[String] | None)
if_ (String | None)
runs_on_ (RunsOn | None)
environment_ (Environment | None)
concurrency_ (Concurrency | None)
outputs_ (None)
env_ (Env | None)
defaults_ (Defaults | None)
timeout_minutes_ (int | None)
strategy_ (Strategy | None)
container_ (Container | None)
services_ (None)
uses_ (String | None)
secrets_ (Secrets | None)
- job_id_¶
Unique identifier for this job
- Type:
str
- permissions_¶
Job-level permission overrides
- Type:
- environment_¶
Deployment environment settings
- Type:
Environment | None
- concurrency_¶
Job-level concurrency controls
- Type:
Concurrency | None
- outputs_¶
Job outputs for use by dependent jobs
- Type:
None
- timeout_minutes_¶
Maximum job execution time
- Type:
int | None
- services_¶
Service containers for job
- Type:
None
- class validate_actions.domain_model.ast.Step(pos, exec, contexts, id_=None, if_=None, name_=None, env_=None, continue_on_error_=None, timeout_minutes_=None)[source]¶
Bases:
objectIndividual step within a job.
Steps are the atomic execution units that either run shell commands or invoke GitHub Actions.
- Parameters:
- continue_on_error_¶
Whether job should continue if step fails
- Type:
bool | None
- timeout_minutes_¶
Maximum step execution time
- Type:
int | None
- class validate_actions.domain_model.ast.Exec[source]¶
Bases:
ABCAbstract base class for step execution types.
Steps can either run shell commands or invoke GitHub Actions.
- class validate_actions.domain_model.ast.ActionMetadata(required_inputs=<factory>, possible_inputs=<factory>, version_tags=<factory>, outputs=<factory>)[source]¶
Bases:
objectMetadata about a GitHub Action for validation.
Retrieved from GitHub API or action.yml files to validate action usage and provide auto-completion.
- Parameters:
required_inputs (List[str])
possible_inputs (List[str])
version_tags (List[Dict])
outputs (Dict[str, str])
- required_inputs¶
List of mandatory input parameter names
- Type:
List[str]
- possible_inputs¶
List of all supported input parameter names
- Type:
List[str]
- version_tags¶
Available version tags for the action
- Type:
List[Dict]
- outputs¶
Dictionary mapping output names to descriptions
- Type:
Dict[str, str]
- class validate_actions.domain_model.ast.ExecAction(pos, uses_, with_, metadata=None, with_args_=None, with_entrypoint_=None)[source]¶
Bases:
ExecStep that executes a GitHub Action.
Invokes reusable actions from GitHub Marketplace or repositories.
- Parameters:
- uses_¶
Action reference (org/repo@version)
- Type:
- metadata¶
Optional action metadata for validation
- Type:
ActionMetadata | None