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.
nhedger/setup-mago action installs the Mago PHP toolchain CLI on GitHub Actions runners. It runs on Node.js 24, supports Linux, macOS, and Windows, and can automatically detect the correct Mago version from your project’s composer.lock or composer.json before falling back to the latest published release.
Action Metadata
| Field | Value |
|---|---|
| Name | Setup Mago |
| Author | nhedger |
| Description | Setup the Mago CLI in GitHub Actions |
| Runs using | node24 |
| Entry point | dist/index.mjs |
Usage
Add the action to any workflow step. All inputs are optional in practice — the built-ingithub.token is used by default and the version is auto-detected from your project’s dependencies.
Automatic version detection
Omit theversion input to let the action resolve the Mago version from your project’s lock file or manifest:
Latest version
Explicitly request the latest stable release:Specific version
Pin to an exact release by supplying a bare semver string:Inputs
The version of the Mago CLI to install. Accepts:
""(empty string, default) — triggers automatic version detection from your project’scomposer.lockorcomposer.json; falls back tolatestif no version is found"latest"— installs the highest stable release- A bare semver string such as
"0.7.0"— installs that exact release
v prefix (use "0.7.0", not "v0.7.0").A GitHub token used to authenticate API requests against the
carthage-software/mago repository. The action uses the GitHub API to enumerate releases and locate the correct binary asset.The default ${{ github.token }} is sufficient for most workflows. For high-traffic repositories that may hit unauthenticated rate limits, supply a Personal Access Token (PAT):The directory the action searches for
composer.lock and composer.json when performing automatic version detection. Defaults to the current working directory when left empty.Use this input when your PHP project root is not at the repository root:If the specified directory does not exist on the runner, the action emits a warning and falls back to the current working directory.
Version Resolution
Whenversion is not explicitly set, the action resolves which Mago release to install by walking through the following steps in order:
Explicit version input
If the
version input is non-empty, it is used directly. The value may be "latest" or a bare semver string (e.g. "0.7.0").composer.lock
The action reads
composer.lock in the working directory and searches packages-dev for a package whose name equals "carthage-software/mago". If found, the locked version string is used.composer.json
If no lock file entry is found, the action reads
composer.json and checks the require-dev key first, then require, for "carthage-software/mago".- If the value is an exact version, it is used directly.
- If the value is a version range (e.g.
"^0.7.0"), the action fetches all published Mago releases from the GitHub API and returns the highest version satisfying the range.
Download Behavior
Once the target version is resolved, the action downloads the correct pre-compiled binary from thecarthage-software/mago GitHub Releases page.
Asset naming convention
Release assets follow this pattern:| Runner arch | Asset arch |
|---|---|
x64 | x86_64 |
arm64 | aarch64 |
| Platform | Asset filename pattern |
|---|---|
| Linux | mago-{version}-{arch}-unknown-linux-musl.tar.gz |
| macOS | mago-{version}-{arch}-apple-darwin.tar.gz |
| Windows | mago-{version}-{arch}-pc-windows-msvc.zip |
Installation
After the archive is downloaded:.tar.gzarchives (Linux and macOS) are extracted withextractTar..ziparchives (Windows) are extracted withextractZip.- The extracted binary (
magoon Linux/macOS,mago.exeon Windows) is set to permission mode755. - The directory containing the binary is added to
PATHvia@actions/core addPath, makingmagoavailable to all subsequent steps in the job.