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.
In CI, use SUPABASE_ACCESS_TOKEN
Section titled “In CI, use SUPABASE_ACCESS_TOKEN”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 Actionsenv: 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 pushThis 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.
Local scripts
Section titled “Local scripts”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:
supawho use client-a && supabase db pushStop if the active project belongs to an account you haven’t saved. supawho find exits with 1 when no saved account owns the ref:
ref="abcdefghijklmnopqrst"if ! supawho find "$ref" > /dev/null; then echo "No saved Supabase account can access $ref" >&2 exit 1fiExit codes
Section titled “Exit codes”| 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 |
Update notice
Section titled “Update notice”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:
export SUPAWHO_NO_UPDATE_CHECK=1Headless machines and SSH
Section titled “Headless machines and SSH”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_TOKENis 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:
supawho add client-a "$CLIENT_A_TOKEN"