Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat(action): service account via env var (#17392)

p0ny213e880d7ca6
diff --git a/action/README.md b/action/README.md
index 6bc501f388..33c12a8fb6 100644
--- a/action/README.md
+++ b/action/README.md
@@ -37,10 +37,10 @@ These flags apply to the main `bytebase-action` command and its subcommands (`ch
- Default: `https://demo.bytebase.com`
- **`--service-account`**: The service account email.
- - Default: `[email protected]`
+ - Default: `[email protected]`. If not provided via flag, reads from the `BYTEBASE_SERVICE_ACCOUNT` environment variable.
- **`--service-account-secret`**: The service account password.
- - Default: Reads from the `BYTEBASE_SERVICE_ACCOUNT_SECRET` environment variable. You can override this by providing the flag directly.
+ - Default: `""` (empty string). If not provided via flag, reads from the `BYTEBASE_SERVICE_ACCOUNT_SECRET` environment variable.
- *Note: Setting the environment variable `BYTEBASE_SERVICE_ACCOUNT_SECRET` is the recommended way to handle the secret.*
- **`--project`**: The target Bytebase project name.
diff --git a/action/command/validation/flags.go b/action/command/validation/flags.go
index d549f1264b..2ee1863405 100644
--- a/action/command/validation/flags.go
+++ b/action/command/validation/flags.go
@@ -14,7 +14,10 @@ import (
// ValidateFlags validates all the command line flags and environment variables.
func ValidateFlags(w *world.World) error {
- // Set service account secret from environment if not provided
+ // Set service account and secret from environment if not provided
+ if w.ServiceAccount == "" {
+ w.ServiceAccount = os.Getenv("BYTEBASE_SERVICE_ACCOUNT")
+ }
if w.ServiceAccountSecret == "" {
w.ServiceAccountSecret = os.Getenv("BYTEBASE_SERVICE_ACCOUNT_SECRET")
}