Act Runner
Proxy for the act GitHub Actions local runner.
Handles detection, installation guidance, and workflow verification by delegating to the act CLI with sensible defaults.
- exception pypreset.act_runner.ActError[source]
Bases:
ExceptionRaised when an act operation fails.
- class pypreset.act_runner.ActCheckResult[source]
Bases:
objectResult of checking whether act is available.
- class pypreset.act_runner.ActInstallResult[source]
Bases:
objectResult of attempting to install act.
- class pypreset.act_runner.WorkflowVerifyResult[source]
Bases:
objectComplete result of a workflow verification.
- Parameters:
- runs: list[ActRunResult]
- pypreset.act_runner.check_act()[source]
Check if act is installed and return version info.
Performs a meta-check: if act –version fails, verifies whether the binary truly isn’t on PATH vs some other issue.
- Return type:
- pypreset.act_runner.get_install_suggestion()[source]
Return a human-readable install suggestion and optional command.
- pypreset.act_runner.install_act()[source]
Attempt to install act automatically on supported systems.
- Return type:
- pypreset.act_runner.run_act(*, project_dir, workflow_file=None, job=None, event='push', dry_run=False, list_jobs=False, platform_map=None, extra_flags=None, timeout=600)[source]
Run act with the given options.
- Parameters:
project_dir (
Path) – The project root (cwd for act).workflow_file (
Path|None) – Specific workflow file to run (relative to project_dir).event (
str) – GitHub event to simulate (default: push).dry_run (
bool) – Run in dry-run mode (validate without executing).list_jobs (
bool) – Just list available jobs.platform_map (
str|None) – Platform mapping (e.g. ‘ubuntu-latest=catthehacker/ubuntu:act-latest’).extra_flags (
list[str] |None) – Additional flags to pass to act.timeout (
int) – Command timeout in seconds.
- Return type:
- Returns:
ActRunResult with command output.
- pypreset.act_runner.verify_workflow(*, project_dir, workflow_file=None, job=None, event='push', dry_run=True, platform_map=None, extra_flags=None, timeout=600, auto_install=False)[source]
Verify a GitHub Actions workflow using act.
This is the main entry point. It: 1. Checks if act is installed (with meta-check on failure) 2. Optionally attempts auto-install 3. Lists workflow jobs for info 4. Runs the workflow in dry-run or full mode 5. Surfaces all act output back to the caller
- Parameters:
project_dir (
Path) – Path to the project root.workflow_file (
Path|None) – Specific workflow file (relative to project). If None, act will discover workflows in .github/workflows/.job (
str|None) – Specific job name to run. If None, runs all jobs.event (
str) – GitHub event to simulate.dry_run (
bool) – If True, validate without executing containers.extra_flags (
list[str] |None) – Additional flags forwarded to act.timeout (
int) – Timeout in seconds for act commands.auto_install (
bool) – Attempt automatic installation if act is missing.
- Return type:
- Returns:
WorkflowVerifyResult with all details.