Setup Mago is a GitHub Action that installs the Mago CLI on GitHub Actions runners, giving your PHP CI pipelines a fast, consistent way to lint and format code. Mago is a PHP toolchain developed by carthage-software that focuses on speed and developer ergonomics. Rather than manually downloading and configuring the CLI in each workflow, Setup Mago handles the entire installation in a single step — detecting the right version, fetching the correct binary for the runner, and placing theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nhedger/setup-mago/llms.txt
Use this file to discover all available pages before exploring further.
mago executable on the PATH.
Why Setup Mago
PHP projects that rely on Mago for linting and formatting need a reliable way to install the same version of the CLI in CI that they use locally. Setup Mago solves this by reading the version ofcarthage-software/mago pinned in your composer.lock file, so the runner always matches your local environment without any manual configuration. If no lockfile entry is found, the action checks composer.json and, as a final fallback, installs the latest stable release.
Key Capabilities
- Automatic version detection — reads
composer.lockfirst, thencomposer.json, then falls back to the latest stable release, so the installed version always matches your project dependencies. - Cross-platform — runs on Linux (
ubuntu-*), macOS (macos-*), and Windows (windows-*) runners without any platform-specific configuration. - x64 and arm64 support — downloads the appropriate binary for both
x86_64andaarch64architectures automatically. - Simple override — pin any specific version (e.g.
"0.7.0") or request"latest"explicitly via theversioninput when you need precise control.
Inputs at a Glance
Setup Mago exposes three inputs, all optional in practice:| Input | Default | Description |
|---|---|---|
version | (auto-detected) | Version of the Mago CLI to install. Accepts a specific version like "0.7.0", the string "latest", or can be omitted entirely to trigger auto-detection. |
token | ${{ github.token }} | GitHub token used to authenticate API requests when resolving releases. The default job token is sufficient for most projects. |
working-directory | (current directory) | Directory the action searches for composer.lock and composer.json when auto-detecting the Mago version. |
Explore the Docs
Quickstart
Add Setup Mago to your workflow in minutes with a minimal working example.
Version Detection
Learn how the action resolves the Mago version from your Composer files.
Inputs Reference
Full reference for the
version, token, and working-directory inputs.Examples
Ready-to-use workflow snippets for common setup scenarios.