Run GitHub Actions locally using nektos/act from a Python CLI
Project description
Gasket
A Python CLI tool that wraps nektos/act to run GitHub Actions workflows locally via Docker.
Built with Click for composable commands.
Prerequisites
- Python 3.10+
- Docker - must be installed and running
- nektos/act - installed automatically via
gasket setup install-act
Installation
# Clone the repository
git clone <repo-url>
cd gasket
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
# Install in development mode
pip install -e ".[dev]"
# Install act (if not already installed)
gasket setup install-act
# Verify installation
gasket --version
gasket --help
Or use the standalone installer:
python install.py
Commands
run-act
Run GitHub Actions workflows locally using nektos/act.
gasket run-act # Run push event workflows
gasket run-act --event pull_request # Run pull_request workflows
gasket run-act --list # List available workflows
gasket run-act --dry-run # Dry run only
gasket run-act -j test # Run specific job
gasket run-act -W .github/workflows/ci.yml # Run specific workflow
gasket run-act -s MY_SECRET=value # Pass secrets
gasket run-act -P ubuntu-latest=node:16-buster-slim # Platform override
| Option | Type | Default | Description |
|---|---|---|---|
--event / -e |
Choice | push |
Event type: push, pull_request, workflow_dispatch, schedule, release |
--workflow / -W |
Path | None | Specific workflow file or directory |
--job / -j |
String | None | Specific job name to run |
--secret / -s |
String | None | Secret in KEY=VALUE format (repeatable) |
--secret-file |
Path | None | Path to secrets file (.env format) |
--var |
String | None | Variable in KEY=VALUE format (repeatable) |
--var-file |
Path | None | Path to variables file |
--input |
String | None | Input in KEY=VALUE format for workflow_dispatch (repeatable) |
--input-file |
Path | None | Path to inputs file |
--event-file |
Path | None | Path to event JSON payload file |
--platform / -P |
String | None | Platform override RUNNER=IMAGE (repeatable) |
--env |
String | None | Environment variable KEY=VALUE (repeatable) |
--env-file |
Path | None | Path to env file |
--matrix |
String | None | Matrix filter KEY:VALUE (repeatable) |
--container-architecture |
String | None | Container architecture (e.g. linux/amd64) |
--artifact-server-path |
Path | None | Path to enable artifact server |
--dry-run / -n |
Flag | False |
Dry run mode |
--list / -l |
Flag | False |
List workflows without running |
--verbose / -v |
Flag | False |
Verbose output |
--offline |
Flag | False |
Use cached actions (offline mode) |
--timeout |
Integer | 600 |
Timeout in seconds |
setup
Manage installation and prerequisites.
gasket setup check # Check all prerequisites
gasket setup check --format json # JSON output
gasket setup install-act # Download and install act
gasket setup install-act --force # Force reinstall
gasket setup install-all # Install everything + verify
gasket setup uninstall-act # Remove act binary
setup check
Check if Python, act, Docker, and Git are available.
setup install-act
Download the appropriate act binary for the current platform from GitHub releases.
| Option | Type | Description |
|---|---|---|
--install-dir |
Path | Custom install directory |
--force |
Flag | Reinstall even if already installed |
setup install-all
Install all dependencies and verify the environment.
setup uninstall-act
Remove the act binary.
Exit Codes
| Code | Meaning |
|---|---|
0 |
Success |
1 |
Execution error |
3 |
act not found |
Testing
# Run all tests
pytest
# Run with coverage
pytest --cov=gasket --cov-report=term-missing
# Run specific test file
pytest tests/test_run_act.py -v
Project Structure
gasket/
├── pyproject.toml
├── install.py # Standalone bootstrap installer
├── src/
│ └── gasket/
│ ├── cli.py # Main CLI entry point (click.group)
│ ├── commands/
│ │ ├── run_act.py # run-act command
│ │ └── setup.py # setup command group
│ └── core/
│ ├── act_runner.py # act subprocess wrapper
│ └── act_installer.py # act binary downloader/installer
└── tests/
├── test_run_act.py
└── test_setup.py
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gasket_cli-0.2.2.tar.gz.
File metadata
- Download URL: gasket_cli-0.2.2.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99fa072e4f771c0073404211e289fb6fc984c7224062b437b965da8002729291
|
|
| MD5 |
a603d36bb447a28d30fd77991e64ad5f
|
|
| BLAKE2b-256 |
d3b739d60fc14b6b9072370f48acdb32c6e448186e444c595948fa58828ebb61
|
File details
Details for the file gasket_cli-0.2.2-py3-none-any.whl.
File metadata
- Download URL: gasket_cli-0.2.2-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0d07712b9efd6afc7cb5fec7a2eacafd8fef8cbb7b31efb2eb88eebb2198ff5
|
|
| MD5 |
6fedd57865d4c795e7a500f187133e51
|
|
| BLAKE2b-256 |
b49ae384207e83b8c8c907013342b4f7b2343c4cd7f60a08044972b8960f541e
|