ghenv

Quickstart

Install ghenv

Use Linux or macOS on x86_64 or arm64. Install the GitHub CLI and sign in to GitHub.com. Use an account with Actions dispatch and artifact access to the repository.

curl -fsSL https://raw.githubusercontent.com/nicodes/ghenv/main/install.sh | sh
Terminal
gh auth login
ghenv --version

The installer places the verified executable in ~/.local/bin. Add that directory to your shell’s PATH.

Prepare GitHub Preview

Create a Preview environment in your repository. Follow the published workflow example on main and pin the exporter to a reviewed commit. Your repository owner must set GHENV_PREVIEW_BUNDLE to the approved development values.

See the bundle format for an example. Environment reviewers and branch restrictions still apply.

ghenv doctor --repo OWNER/REPO --workflow pr-preview.yml

Run the application

Replace OWNER/REPO with the GitHub repository’s exact spelling and select the names your app expects. Put the application command after --.

Terminal
ghenv run --repo OWNER/REPO --workflow pr-preview.yml \
  --secrets API_KEY --vars API_BASE_URL -- npm run dev

The workflow runs once for that launch. The app uses the selected variables from its environment.