Run Toggly CLI from GitHub Actions
Use the ops-ai/toggly-action composite action to install a pinned toggly-cli release in your workflow and run the same commands you would run locally.
This page covers your pipeline calling Toggly. If you need the opposite direction — Toggly dispatching a workflow when a flag changes — see GitHub Actions Integration.
What it does
- Downloads the
cli-v*asset that matches the runner OS and architecture. - Verifies the file against
SHA256SUMSfrom the same release. - Runs
toggly-cliwith the arguments you supply (quote-aware argv; not viabash -c).
The action does not call the Toggly HTTP API and does not start device-code login.
Pin rule
Always set version to an exact MAJOR.MINOR.PATCH that exists as a cli-v* release (for example 0.2.1 → tag cli-v0.2.1). Do not use latest.
Secrets
Store client credentials as GitHub Actions secrets and pass them as environment variables. Do not put secrets in args.
| Variable | Required | Purpose |
|---|---|---|
TOGGLY_CLIENT_ID | yes | OAuth2 client ID |
TOGGLY_CLIENT_SECRET | yes | OAuth2 client secret |
TOGGLY_BASE_URL | no | Override API base URL |
TOGGLY_AUTHORITY | no | Override auth authority |
Examples below use flags verified against toggly-cli 0.2.1.
Recipe 1: Enable a flag after deploy
- name: Enable feature in Production
uses: ops-ai/toggly-action@v1
with:
version: "0.2.1"
args: >-
update-feature-environment
--application-id my-app
--environment Production
--feature-key my-feature
--enable
env:
TOGGLY_CLIENT_ID: ${{ secrets.TOGGLY_CLIENT_ID }}
TOGGLY_CLIENT_SECRET: ${{ secrets.TOGGLY_CLIENT_SECRET }}
Use --disable instead of --enable to turn the feature off.
Recipe 2: Create a release
- name: Create Toggly release
uses: ops-ai/toggly-action@v1
with:
version: "0.2.1"
args: >-
create-release
--application-id my-app
--name "Build ${{ github.run_number }}"
--release-notes "Shipped from ${{ github.ref_name }}"
env:
TOGGLY_CLIENT_ID: ${{ secrets.TOGGLY_CLIENT_ID }}
TOGGLY_CLIENT_SECRET: ${{ secrets.TOGGLY_CLIENT_SECRET }}
Recipe 3: Associate the build
- name: Associate build with release
uses: ops-ai/toggly-action@v1
with:
version: "0.2.1"
args: >-
associate-build
--project-key my-app
--environment Production
--ci-provider github
--run-id ${{ github.run_id }}
--pipeline-name "${{ github.workflow }}"
--branch ${{ github.ref_name }}
--commit-sha ${{ github.sha }}
--build-number ${{ github.run_number }}
--run-url ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
env:
TOGGLY_CLIENT_ID: ${{ secrets.TOGGLY_CLIENT_ID }}
TOGGLY_CLIENT_SECRET: ${{ secrets.TOGGLY_CLIENT_SECRET }}
Related
- GitHub Actions Integration — Toggly triggers your workflow (workflow dispatch)
- CI/CD Integration — Release Tracker HTTP APIs
- Toggly CLI — install, auth, and command reference