A lightweight CLI tool for running GitHub Actions workflows locally
Raptor is a CLI tool for running GitHub Actions workflow files (.github/workflows/*.yml) in your local environment. Test your CI pipelines locally before pushing.
- Native support for GitHub Actions workflow YAML
- Job dependencies (
needs) with automatic dependency resolution - Environment variables support at workflow/job/step levels
- Dynamic environment variable propagation via
GITHUB_ENV/GITHUB_PATH - Per-step working directory configuration
- Lightweight and simple design
Download the binary for your platform from the releases page.
curl -LO https://github.com/watany-dev/raptor/releases/download/v0.2.0/raptor_0.2.0_Linux_x86_64.tar.gz
tar xzf raptor_0.2.0_Linux_x86_64.tar.gz
sudo mv raptor /usr/local/bin/
raptor --versioncurl -LO https://github.com/watany-dev/raptor/releases/download/v0.2.0/raptor_0.2.0_Linux_arm64.tar.gz
tar xzf raptor_0.2.0_Linux_arm64.tar.gz
sudo mv raptor /usr/local/bin/
raptor --versioncurl -LO https://github.com/watany-dev/raptor/releases/download/v0.2.0/raptor_0.2.0_Darwin_arm64.tar.gz
tar xzf raptor_0.2.0_Darwin_arm64.tar.gz
sudo mv raptor /usr/local/bin/
raptor --versioncurl -LO https://github.com/watany-dev/raptor/releases/download/v0.2.0/raptor_0.2.0_Darwin_x86_64.tar.gz
tar xzf raptor_0.2.0_Darwin_x86_64.tar.gz
sudo mv raptor /usr/local/bin/
raptor --versiongo install github.com/watany-dev/raptor/cmd/raptor@v0.2.0git clone https://github.com/watany-dev/raptor.git
cd raptor
go build -o raptor ./cmd/raptor
sudo mv raptor /usr/local/bin/- Supported platforms: Linux, macOS (Windows is not supported)
- Runtime: Git 2.5 or later
- Build from source only: Go 1.24 or later
# Run a specific job
raptor run --workflow <workflow-file> --job <job-id>
# Run all jobs (omit --job)
raptor run --workflow <workflow-file>| Option | Short | Description |
|---|---|---|
--workflow |
-w |
Path to workflow file (required) |
--job |
-j |
Job ID to run (runs all jobs if omitted) |
--workdir |
-C |
Working directory (default: current directory) |
--dry-run |
-n |
Preview without actually executing |
--ignore-if-errors |
Ignore condition evaluation errors (legacy mode) |
Note: All workflows are executed in isolated Git worktrees for security.
Dry-run mode allows you to preview what will be executed without actually running the workflow. Useful for checking and debugging CI pipelines.
# Explicitly specify dry-run flag
raptor run -w ci.yml --dry-run
raptor run -w ci.yml -n
# Omit run subcommand for automatic dry-run mode
raptor -w ci.ymlExample dry-run output:
π DRY RUN MODE
βββββββββββββββββββββββββββββββββββββββββββββββββ
Workflow: .github/workflows/ci.yml
Name: CI
βββββββββββββββββββββββββββββββββββββββββββββββββ
π Job: build
Runs-on: ubuntu-latest
[1] Build
Command:
echo "Building..."
π Job: test
Depends on: build
Runs-on: ubuntu-latest
[1] Test
Command:
echo "Testing..."
βββββββββββββββββββββββββββββββββββββββββββββββββ
To execute this workflow, use: raptor run -w .github/workflows/ci.yml
Information displayed:
- Workflow name and path
- Job ID, name, and runs-on
- Each step's name, working directory, conditions (
if), number of environment variables, and command content
# Run the build job from CI workflow
raptor run --workflow .github/workflows/ci.yml --job build
# Use short form
raptor run -w ci.yml -j test
# Run all jobs in workflow
raptor run -w ci.yml
# Run with specified working directory
raptor run -w .github/workflows/ci.yml -j lint -C /path/to/projectWhen using -j to run a specific job, Raptor automatically resolves and executes all its dependencies first:
# If deploy needs test, and test needs build:
# This runs: build β test β deploy
raptor run -w ci.yml -j deployIf a dependency fails, dependent jobs are automatically skipped:
INFO running job job_id=build
INFO running job job_id=test
INFO skipping job job_id=deploy reason="dependency 'test' failed"
raptor help
raptor --helpraptor version
raptor --version
raptor -vCurrently supported GitHub Actions syntax:
| Feature | Support |
|---|---|
name (workflow/job/step names) |
β |
needs (job dependencies) |
β |
env (environment variables) |
β |
run (shell commands) |
β |
working-directory |
β |
GITHUB_ENV |
β |
GITHUB_PATH |
β |
if (conditionals) |
β (full support with AND/OR/NOT, string functions, hashFiles) |
uses (actions) |
β |
with (action inputs) |
β |
matrix (matrix builds) |
β |
Conditional step execution is supported:
steps:
- name: Always run
if: true
run: echo "This always runs"
- name: Conditional
if: ${{ env.MY_VAR == 'value' }}
run: echo "Runs when MY_VAR is 'value'"
- name: On failure
if: failure()
run: echo "Runs only if previous step failed"
- name: Always (even on failure)
if: always()
run: echo "Cleanup step"
- name: Complex conditions with AND/OR
if: ${{ success() && env.DEPLOY_ENV == 'production' }}
run: echo "Deploy to production"
- name: String functions
if: ${{ startsWith(env.BRANCH_NAME, 'feature/') }}
run: echo "Feature branch detected"
- name: File hash for caching
if: ${{ hashFiles('package.json') != '' }}
run: echo "package.json exists"Supported conditional syntax:
| Syntax | Description |
|---|---|
true / false |
Literal boolean values |
success() |
All previous steps succeeded |
failure() |
Any step failed |
always() |
Always execute (continue after failure) |
cancelled() |
Execute on cancellation (always false) |
${{ env.VAR == 'value' }} |
Environment variable comparison |
${{ env.VAR != 'value' }} |
Environment variable negation |
${{ steps.ID.outcome == 'success' }} |
Step result reference |
${{ expr1 && expr2 }} |
Logical AND operator |
${{ expr1 || expr2 }} |
Logical OR operator |
${{ !expr }} |
Logical NOT operator |
${{ (expr) }} |
Grouping with parentheses |
contains(search, item) |
Check if string/array contains value |
startsWith(search, prefix) |
Check if string starts with prefix |
endsWith(search, suffix) |
Check if string ends with suffix |
hashFiles(pattern, ...) |
Calculate SHA-256 hash of files matching patterns |
Error Handling:
By default, Raptor uses strict mode for condition evaluation. If a condition has syntax errors or evaluation errors, the workflow will stop with a clear error message. This helps catch typos and invalid expressions early.
# Default behavior: strict mode
raptor run -w workflow.yml
# Error: failed to evaluate if condition: condition parse error: unexpected token
# Legacy behavior: ignore errors and continue
raptor run -w workflow.yml --ignore-if-errors
# Warning: failed to evaluate if condition: parse error: ... (defaulting to true)Example workflow that can be run with Raptor:
name: CI
env:
GLOBAL_VAR: "global-value"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build
run: echo "Building..."
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Test
run: echo "Testing..."
deploy:
runs-on: ubuntu-latest
needs: [build, test]
steps:
- name: Deploy
if: success()
run: echo "Deploying..."Since Raptor executes commands described in workflow files, only run trusted workflows.
- Isolated execution: All workflows run in isolated Git worktrees
- Absolute path prohibition: Absolute paths cannot be used in
working-directory - Environment variable protection: Dangerous environment variables like
LD_PRELOADare blocked - Input validation: Environment variable names and values are validated
See SECURITY.md for details.
Raptor runs workflows with your user permissions. Malicious workflows can:
- Delete or modify files
- Access network
- Send data externally
Always verify the content before running.
go build ./...go test ./...go test -cover ./...raptor/
βββ cmd/raptor/ # CLI entry point
βββ internal/
β βββ cli/ # CLI flag parsing and runner
β βββ dag/ # Job dependency graph (topological sort)
β βββ envfiles/ # GITHUB_ENV/GITHUB_PATH parsing
β βββ executor/ # Command execution engine
β βββ expression/ # Expression evaluation (if conditions)
β βββ runtime/ # Environment variable merging
β βββ security/ # Security validation
β βββ util/ # Git operation utilities
β βββ workflow/ # Workflow YAML parsing
β βββ worktree/ # Git worktree management
βββ docs/ # Development documentation
Apache License 2.0