CLI Commands
The gh aw CLI extension enables developers to create, manage, and execute AI-powered workflows directly from the command line. It transforms natural language markdown files into GitHub Actions.
Most Common Commands
Section titled “Most Common Commands”Most users only need these 6 commands:
-
gh aw init- Set up your repository for agentic workflows
→ Documentation -
gh aw add (workflow)- Add workflows from other repositories
→ Documentation -
gh aw compile- Convert markdown to GitHub Actions YAML after editing
→ Documentation -
gh aw list- Quick listing of all workflows without status checks
→ Documentation -
gh aw run (workflow)- Execute workflows immediately in GitHub Actions
→ Documentation -
gh aw status- Check current state of all workflows
→ Documentation
Installation
Section titled “Installation”Install the GitHub CLI extension:
gh extension install github/gh-awPinning to a Specific Version
Section titled “Pinning to a Specific Version”Pin to specific versions for production environments, team consistency, or avoiding breaking changes:
gh extension install github/gh-aw@v0.1.0 # Pin to release taggh extension install github/gh-aw@abc123def456 # Pin to commit SHAgh aw version # Check current version
# Upgrade pinned versiongh extension remove gh-awgh extension install github/gh-aw@v0.2.0Alternative: Standalone Installer
Section titled “Alternative: Standalone Installer”Use the standalone installer if extension installation fails (common in Codespaces, restricted networks, or with auth issues):
curl -sL https://raw.githubusercontent.com/github/gh-aw/main/install-gh-aw.sh | bash # Latestcurl -sL https://raw.githubusercontent.com/github/gh-aw/main/install-gh-aw.sh | bash -s v0.1.0 # PinnedInstalls to ~/.local/share/gh/extensions/gh-aw/gh-aw. Supports Linux, macOS, FreeBSD, and Windows. Works behind corporate firewalls using direct release download URLs.
GitHub Actions Setup Action
Section titled “GitHub Actions Setup Action”Install the CLI in GitHub Actions workflows using the setup-cli action with automatic checksum verification and platform detection:
- name: Install gh-aw CLI uses: github/gh-aw/actions/setup-cli@main with: version: v0.37.18See the setup-cli action README for complete documentation.
GitHub Enterprise Server Support
Section titled “GitHub Enterprise Server Support”Configure for GitHub Enterprise Server deployments:
export GH_HOST="github.enterprise.com" # Set hostnamegh auth login --hostname github.enterprise.com # Authenticategh aw logs workflow --repo github.enterprise.com/owner/repo # Use with commandsGlobal Options
Section titled “Global Options”| Flag | Description |
|---|---|
-h, --help | Show help (gh aw help [command] for command-specific help) |
-v, --verbose | Enable verbose output with debugging details |
The --push Flag
Section titled “The --push Flag”Several commands support the --push flag to automatically commit and push changes to the remote repository:
- Remote check: Requires a remote repository to be configured
- Branch validation: Verifies current branch matches repository default branch (or specified with
--ref) - User confirmation: Prompts for confirmation before committing/pushing (skipped in CI)
- Automatic commit: Creates commit with descriptive message
- Pull and push: Pulls latest changes with rebase, then pushes to remote
Safety features:
- Prevents accidental pushes to non-default branches (unless explicitly specified)
- Requires explicit user confirmation outside CI environments
- Auto-confirms in CI (detected via
CI,CONTINUOUS_INTEGRATION,GITHUB_ACTIONSenv vars)
Commands with --push require a clean working directory (no uncommitted changes) before starting.
Commands
Section titled “Commands”Commands are organized by workflow lifecycle: creating, building, testing, monitoring, and managing workflows.
Getting Workflows
Section titled “Getting Workflows”Initialize repository for agentic workflows. Configures .gitattributes, Copilot instructions, prompt files, and logs .gitignore. Enables MCP server integration by default (use --no-mcp to skip). Without arguments, enters interactive mode for engine selection and secret configuration.
gh aw init # Interactive mode: select engine and configure secretsgh aw init --no-mcp # Skip MCP server integrationgh aw init --codespaces # Configure devcontainer for current repogh aw init --codespaces repo1,repo2 # Configure devcontainer for additional reposgh aw init --completions # Install shell completionsgh aw init --push # Initialize and automatically commit/push changesOptions: --no-mcp, --codespaces, --completions, --push (see —push flag)
Add workflows from The Agentics collection or other repositories to .github/workflows.
gh aw add githubnext/agentics/ci-doctor # Add single workflowgh aw add "githubnext/agentics/ci-*" # Add multiple with wildcardsgh aw add ci-doctor --dir shared # Organize in subdirectorygh aw add ci-doctor --create-pull-request # Create PR instead of commitOptions: --dir, --create-pull-request (or --pr), --no-gitattributes
Create a workflow template in .github/workflows/. Opens for editing automatically.
gh aw new # Interactive modegh aw new my-custom-workflow # Create template (.md extension optional)gh aw new my-workflow --force # Overwrite if existssecrets
Section titled “secrets”Manage GitHub Actions secrets and tokens.
secrets set
Section titled “secrets set”Create or update a repository secret (from stdin, flag, or environment variable).
gh aw secrets set MY_SECRET # From stdin (current repo)gh aw secrets set MY_SECRET --repo myorg/myrepo # Specify target repogh aw secrets set MY_SECRET --value "secret123" # From flaggh aw secrets set MY_SECRET --value-from-env MY_TOKEN # From env varOptions: --repo, --value, --value-from-env, --api-url
secrets bootstrap
Section titled “secrets bootstrap”Analyze workflows to determine required secrets and interactively prompt for missing ones. Auto-detects engines in use and validates tokens before uploading to the repository.
gh aw secrets bootstrap # Analyze all workflows and prompt for missing secretsgh aw secrets bootstrap --engine copilot # Check only Copilot secretsgh aw secrets bootstrap --non-interactive # Display missing secrets without promptingWorkflow-based discovery: Scans .github/workflows/*.md to identify engines in use, collects the union of required secrets across all workflows, and filters out optional secrets. Only shows secrets that are actually needed based on your workflow configuration.
Interactive prompting: For each missing required secret, prompts for the value, validates the token, and uploads it to the repository. Use --non-interactive to display missing secrets without prompting (display-only mode).
Options: --engine (copilot, claude, codex), --non-interactive, --owner, --repo
See Authentication for details.
Building
Section titled “Building”Auto-fix deprecated workflow fields using codemods. Runs in dry-run mode by default; use --write to apply changes.
gh aw fix # Check all workflows (dry-run)gh aw fix --write # Fix all workflowsgh aw fix my-workflow --write # Fix specific workflowgh aw fix --list-codemods # List available codemodsOptions: --write, --list-codemods
Notable codemods include expires-integer-to-string, which converts bare integer expires values (e.g., expires: 7) to the preferred day-string format (e.g., expires: 7d) in all safe-outputs blocks. Run gh aw fix --list-codemods to see all available codemods.
compile
Section titled “compile”Compile Markdown workflows to GitHub Actions YAML. Remote imports cached in .github/aw/imports/.
gh aw compile # Compile all workflowsgh aw compile my-workflow # Compile specific workflowgh aw compile --watch # Auto-recompile on changesgh aw compile --validate --strict # Schema + strict mode validationgh aw compile --fix # Run fix before compilationgh aw compile --zizmor # Security scan (warnings)gh aw compile --strict --zizmor # Security scan (fails on findings)gh aw compile --dependabot # Generate dependency manifestsgh aw compile --purge # Remove orphaned .lock.yml filesOptions: --validate, --strict, --fix, --zizmor, --dependabot, --json, --watch, --purge
Error Reporting: Displays detailed error messages with file paths, line numbers, column positions, and contextual code snippets.
Dependabot Integration (--dependabot): Generates dependency manifests and .github/dependabot.yml by analyzing runtime tools across all workflows. See Dependabot Support reference.
Strict Mode (--strict): Enforces security best practices: no write permissions (use safe-outputs), explicit network config, no wildcard domains, pinned Actions, no deprecated fields. See Strict Mode reference.
Shared Workflows: Workflows without an on field are detected as shared components. Validated with relaxed schema and skip compilation. See Imports reference.
Testing
Section titled “Testing”Test workflows in temporary private repositories (default) or run directly in specified repository (--repo). Results saved to trials/.
gh aw trial githubnext/agentics/ci-doctor # Test remote workflowgh aw trial ./workflow.md --logical-repo owner/repo # Act as different repogh aw trial ./workflow.md --repo owner/repo # Run directly in repositorygh aw trial ./workflow.md --dry-run # Preview without executingOptions: -e, --engine, --auto-merge-prs, --repeat, --delete-host-repo-after, --logical-repo, --clone-repo, --trigger-context, --repo, --dry-run
Secret Handling: API keys required for the selected engine are automatically checked. If missing from the target repository, they are prompted for interactively and uploaded.
Execute workflows immediately in GitHub Actions. Displays workflow URL for tracking.
gh aw run workflow # Run workflowgh aw run workflow1 workflow2 # Run multiple workflowsgh aw run workflow --repeat 3 # Repeat 3 timesgh aw run workflow --push # Auto-commit, push, and dispatch workflowgh aw run workflow --push --ref main # Push to specific branchOptions: --repeat, --push (see —push flag), --ref, --auto-merge-prs, --enable-if-needed
When --push is used, automatically recompiles outdated .lock.yml files, stages all transitive imports, and triggers workflow run after successful push. Without --push, warnings are displayed for missing or outdated lock files.
Monitoring
Section titled “Monitoring”List workflows with basic information (name, engine, compilation status) without checking GitHub Actions state.
gh aw list # List all workflowsgh aw list ci- # Filter by pattern (case-insensitive)gh aw list --json # Output in JSON formatgh aw list --label automation # Filter by labelOptions: --json, --label
Fast enumeration without GitHub API queries. For detailed status including enabled/disabled state and run information, use status instead.
status
Section titled “status”List workflows with state, enabled/disabled status, schedules, and labels. With --ref, includes latest run status.
gh aw status # All workflowsgh aw status --ref main # With run info for main branchgh aw status --label automation # Filter by labelgh aw status --repo owner/other-repo # Check different repositoryOptions: --ref, --label, --json, --repo
Download and analyze logs with tool usage, network patterns, errors, warnings. Results cached for 10-100x speedup on subsequent runs.
gh aw logs workflow # Download logs for workflowgh aw logs -c 10 --start-date -1w # Filter by count and dategh aw logs --ref main --parse --json # With markdown/JSON output for branchWorkflow name matching: The logs command accepts both workflow IDs (kebab-case filename without .md, e.g., ci-failure-doctor) and display names (from frontmatter, e.g., CI Failure Doctor). Matching is case-insensitive for convenience:
gh aw logs ci-failure-doctor # Workflow IDgh aw logs CI-FAILURE-DOCTOR # Case-insensitive IDgh aw logs "CI Failure Doctor" # Display namegh aw logs "ci failure doctor" # Case-insensitive display nameOptions: -c, --count, -e, --engine, --start-date, --end-date, --ref, --parse, --json, --repo
Analyze specific runs with overview, metrics, tool usage, MCP failures, firewall analysis, noops, and artifacts. Accepts run IDs, workflow run URLs, job URLs, and step-level URLs. Auto-detects Copilot coding agent runs for specialized parsing. Job URLs automatically extract specific job logs; step URLs extract specific steps; without step, extracts first failing step.
gh aw audit 12345678 # By run IDgh aw audit https://github.com/owner/repo/actions/runs/123 # By workflow run URLgh aw audit https://github.com/owner/repo/actions/runs/123/job/456 # By job URL (extracts first failing step)gh aw audit https://github.com/owner/repo/actions/runs/123/job/456#step:7:1 # By step URL (extracts specific step)gh aw audit 12345678 --parse # Parse logs to markdownLogs are saved to logs/run-{id}/ with filenames indicating the extraction level (job logs, specific step, or first failing step).
When a workflow fails before the agent executes (for example, due to lockdown validation failures, missing secrets, or binary install failures), the audit report surfaces the actual error from the workflow step log files. The failure_analysis.error_summary field reflects the specific failure message rather than reporting “No specific errors identified”. Providing an invalid run ID returns a human-readable error instead of a raw exit code.
health
Section titled “health”Display workflow health metrics and success rates.
gh aw health # Summary of all workflows (last 7 days)gh aw health issue-monster # Detailed metrics for specific workflowgh aw health --days 30 # Summary for last 30 daysgh aw health --threshold 90 # Alert if below 90% success rategh aw health --json # Output in JSON formatgh aw health issue-monster --days 90 # 90-day metrics for workflowOptions: --days, --threshold, --repo, --json
Shows success/failure rates, trend indicators (↑ improving, → stable, ↓ degrading), execution duration, token usage, costs, and alerts when success rate drops below threshold.
Management
Section titled “Management”enable
Section titled “enable”Enable one or more workflows by ID, or all workflows if no IDs provided.
gh aw enable # Enable all workflowsgh aw enable ci-doctor # Enable specific workflowgh aw enable ci-doctor daily # Enable multiple workflowsgh aw enable ci-doctor --repo owner/repo # Enable in specific repositoryOptions: --repo
disable
Section titled “disable”Disable one or more workflows and cancel any in-progress runs.
gh aw disable # Disable all workflowsgh aw disable ci-doctor # Disable specific workflowgh aw disable ci-doctor daily # Disable multiple workflowsgh aw disable ci-doctor --repo owner/repo # Disable in specific repositoryOptions: --repo
remove
Section titled “remove”Remove workflows (both .md and .lock.yml).
gh aw remove my-workflowupdate
Section titled “update”Update workflows based on source field (owner/repo/path@ref). By default, performs a 3-way merge to preserve local changes; use --no-merge to override with upstream. Semantic versions update within same major version.
gh aw update # Update all with source fieldgh aw update ci-doctor # Update specific workflow (3-way merge)gh aw update ci-doctor --no-merge # Override local changes with upstreamgh aw update ci-doctor --major --force # Allow major version updatesOptions: --dir, --no-merge, --major, --force, --engine, --no-stop-after, --stop-after
upgrade
Section titled “upgrade”Upgrade repository with latest agent files and apply codemods to all workflows.
gh aw upgrade # Upgrade repository agent files and all workflowsgh aw upgrade --no-fix # Update agent files only (skip codemods)gh aw upgrade --push # Upgrade and automatically commit/pushgh aw upgrade --push --no-fix # Update agent files and pushgh aw upgrade --audit # Run dependency health auditgh aw upgrade --audit --json # Dependency audit in JSON formatOptions: --dir, --no-fix, --no-actions, --push (see —push flag), --audit, --json
Advanced
Section titled “Advanced”Manage MCP (Model Context Protocol) servers in workflows. mcp inspect auto-detects safe-inputs.
gh aw mcp list workflow # List servers for workflowgh aw mcp list-tools <mcp-server> # List tools for servergh aw mcp inspect workflow # Inspect and test serversgh aw mcp add # Add MCP tool to workflowSee MCPs Guide.
pr transfer
Section titled “pr transfer”Transfer pull request to another repository, preserving changes, title, and description.
gh aw pr transfer <pr-url> --repo target-owner/target-repomcp-server
Section titled “mcp-server”Run MCP server exposing gh-aw commands as tools. Spawns subprocesses to isolate GitHub tokens.
gh aw mcp-server # stdio transportgh aw mcp-server --port 8080 # HTTP server with SSEgh aw mcp-server --validate-actor # Enable actor validationOptions: --port (HTTP server port), --cmd (custom subprocess command), --validate-actor (enforce actor validation for logs and audit tools)
Available Tools: status, compile, logs, audit, mcp-inspect, add, update
When --validate-actor is enabled, logs and audit tools require write+ repository access via GitHub API (permissions cached for 1 hour). See MCP Server Guide.
Utility Commands
Section titled “Utility Commands”version
Section titled “version”Show gh-aw version and product information.
gh aw versioncompletion
Section titled “completion”Generate and manage shell completion scripts for tab completion.
gh aw completion install # Auto-detect and installgh aw completion uninstall # Remove completionsgh aw completion bash # Generate bash scriptgh aw completion zsh # Generate zsh scriptgh aw completion fish # Generate fish scriptgh aw completion powershell # Generate powershell scriptSubcommands: install, uninstall, bash, zsh, fish, powershell. See Shell Completions.
project
Section titled “project”Create and manage GitHub Projects V2 boards.
project new
Section titled “project new”Create a new GitHub Project V2 owned by a user or organization with optional repository linking.
gh aw project new "My Project" --owner @me # Create user projectgh aw project new "Team Board" --owner myorg # Create org projectgh aw project new "Bugs" --owner myorg --link myorg/myrepo # Create and link to repoOptions:
--owner(required): Project owner - use@mefor current user or specify organization name--link: Repository to link project to (format:owner/repo)
Token Requirements:
hash-frontmatter
Section titled “hash-frontmatter”Compute a deterministic SHA-256 hash of workflow frontmatter for detecting configuration changes.
gh aw hash-frontmatter my-workflow.mdgh aw hash-frontmatter .github/workflows/audit-workflows.mdIncludes all frontmatter fields, imported workflow frontmatter (BFS traversal), template expressions containing env. or vars., and version information (gh-aw, awf, agents).
Shell Completions
Section titled “Shell Completions”Enable tab completion for workflow names, engines, and paths.
Automatic Installation
Section titled “Automatic Installation”gh aw completion install # Auto-detects your shell and installsgh aw completion uninstall # Remove completionsRestart your shell or source your configuration file after installation.
Manual Installation
Section titled “Manual Installation”# Bashgh aw completion bash > ~/.bash_completion.d/gh-aw && source ~/.bash_completion.d/gh-aw
# Zshgh aw completion zsh > "${fpath[1]}/_gh-aw" && compinit
# Fishgh aw completion fish > ~/.config/fish/completions/gh-aw.fish
# PowerShellgh aw completion powershell | Out-String | Invoke-ExpressionDebug Logging
Section titled “Debug Logging”Enable detailed debugging with namespace, message, and time diffs.
DEBUG=* gh aw compile # All logsDEBUG=cli:* gh aw compile # CLI onlyDEBUG=*,-tests gh aw compile # All except testsUse --verbose flag for user-facing details.
Smart Features
Section titled “Smart Features”Fuzzy Workflow Name Matching
Section titled “Fuzzy Workflow Name Matching”Auto-suggests similar workflow names on typos using Levenshtein distance.
gh aw compile audti-workflows# ✗ workflow file not found# Did you mean: audit-workflows?Works with: compile, enable, disable, logs, mcp commands.
Troubleshooting
Section titled “Troubleshooting”| Issue | Solution |
|---|---|
command not found: gh | Install from cli.github.com |
extension not found: aw | Run gh extension install github/gh-aw |
| Compilation fails with YAML errors | Check indentation, colons, and array syntax in frontmatter |
| Workflow not found | Check typo suggestions or run gh aw status to list available workflows |
| Permission denied | Check file permissions or repository access |
| Trial creation fails | Check GitHub rate limits and authentication |
See Common Issues and Error Reference for detailed troubleshooting.
Related Documentation
Section titled “Related Documentation”- Quick Start - Get your first workflow running
- Frontmatter - Configuration options
- Reusing Workflows - Adding and updating workflows
- Security Guide - Security best practices
- MCP Server Guide - MCP server configuration
- Agent Factory - Agent factory status