autoci profile
Manage AutoCI configuration profiles for multiple environments or accounts.
Synopsis
autoci profile [subcommand] [flags]
Description
The profile
command allows you to manage multiple AutoCI account configurations, making it easy to switch between different accounts without re-authenticating each time. This is useful when you work with multiple organizations, have separate personal and team accounts, or manage different client accounts.
Subcommands
list
List all configured profiles.
autoci profile list
Example output:
* account-1 (current)
account-2
team-account
use
Switch to a different profile.
autoci profile use <profile-name>
Example:
# Switch to your secondary account
autoci profile use account-2
# Switch back to your primary account
autoci profile use account-1
current
Display the currently active profile.
autoci profile current
If the AUTOCI_PROFILE
environment variable is set, it will be shown with a note.
remove
Remove a profile and its stored credentials.
autoci profile remove <profile-name>
Example:
autoci profile remove old-account
Environment Variables
You can override the current profile using the AUTOCI_PROFILE
environment variable:
# Use a different account for a single command
AUTOCI_PROFILE=account-2 autoci pr failure-cause
# Export for the current shell session
export AUTOCI_PROFILE=team-account
autoci generate
The environment variable takes precedence over the configured current profile.
Examples
Managing Multiple Accounts
# Login to your primary account
autoci login --profile account-1
# Login to your secondary account
autoci login --profile account-2
# Login to your team's shared account
autoci login --profile team-account
# List all profiles
autoci profile list
# Switch to your secondary account
autoci profile use account-2
# Run commands using the secondary account
autoci pr failure-cause
# Switch back to your primary account
autoci profile use account-1
CI/CD Usage
In CI/CD environments, you can use profiles to manage different organization accounts:
# GitHub Actions example
- name: Analyze with team account
env:
AUTOCI_PROFILE: team-account
run: |
autoci pr failure-cause
- name: Analyze with org account
env:
AUTOCI_PROFILE: org-account
run: |
autoci pr failure-cause
Configuration
Profile configurations are stored in:
- macOS/Linux:
~/.config/autoci/config.json
- Windows:
%USERPROFILE%\.config\autoci\config.json
The configuration file structure:
{
"current_profile": "account-1",
"profiles": {
"account-1": {
"token": "...",
"url": "https://autoci.ai",
"pushServer": "wss://push.autoci.ai",
"userId": "..."
},
"account-2": {
"token": "...",
"url": "https://autoci.ai",
"pushServer": "wss://push.autoci.ai",
"userId": "..."
}
}
}
Best Practices
-
Use descriptive profile names: Choose names that clearly indicate the account (e.g.,
personal
,team-acme
,client-xyz
) -
Protect sensitive accounts: Be cautious when switching profiles to avoid running commands against the wrong account
-
Environment variables in scripts: Use
AUTOCI_PROFILE
in scripts to ensure the correct account is used -
Regular cleanup: Remove unused profiles with
autoci profile remove
to keep your configuration clean
Related Commands
autoci login
- Authenticate with AutoCIautoci logout
- Log out from AutoCI