Skip to content

Using supawho in scripts, and what to use in CI

supawho is built for the machine you work on. It works well in local scripts; in CI, use the Supabase CLI’s own SUPABASE_ACCESS_TOKEN variable instead.

CI runners and containers usually have no OS secret vault, so supawho has nowhere to keep tokens, and a pipeline only ever needs one account anyway. Store a personal access token as an encrypted secret and expose it to the Supabase CLI:

# GitHub Actions
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }}
steps:
- uses: supabase/setup-cli@v1
- run: supabase link --project-ref "$SUPABASE_PROJECT_ID"
- run: supabase db push

This is the setup described in the Supabase guide on managing environments. Create a dedicated token for CI so you can revoke it without touching the ones on your laptop.

Every command except the interactive picker runs without prompts when it gets its arguments, so supawho fits in shell scripts, Makefiles and git hooks.

Switch account before a command:

Terminal window
supawho use client-a && supabase db push

Stop if the active project belongs to an account you haven’t saved. supawho find exits with 1 when no saved account owns the ref:

Terminal window
ref="abcdefghijklmnopqrst"
if ! supawho find "$ref" > /dev/null; then
echo "No saved Supabase account can access $ref" >&2
exit 1
fi
Result Exit code
Command succeeded 0
Handled error: account not found, invalid name, project not found, unknown command 1
Secret vault, Supabase CLI or network failure 1, with a supawho: … message

The daily update check runs only when output goes to a terminal, and it prints to standard error, so pipes and redirected output are never affected. To switch it off everywhere:

Terminal window
export SUPAWHO_NO_UPDATE_CHECK=1

supawho needs an unlocked secret vault:

  • macOS over SSH: the login keychain is locked in sessions without a graphical login. Unlock it with security unlock-keychain ~/Library/Keychains/login.keychain-db.
  • Linux servers: a Secret Service provider must be running and unlocked, which is rarely the case without a desktop session. On such machines SUPABASE_ACCESS_TOKEN is the simpler choice.

See Troubleshooting for the exact error messages.

Keeping a token out of your history in scripts

Section titled “Keeping a token out of your history in scripts”

supawho add <name> <token> is the scriptable form of add. Read the token from a variable or a secret manager rather than typing it on the command line:

Terminal window
supawho add client-a "$CLIENT_A_TOKEN"