From f5705ebfa703d3044832836d24ea1f538d8fa0df Mon Sep 17 00:00:00 2001 From: "Giau. Tran Minh" Date: Mon, 23 Sep 2024 15:58:19 +0700 Subject: [PATCH] atlasaction: fixed `schema-name` input on actions --- atlasaction/action.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/atlasaction/action.go b/atlasaction/action.go index e9e2f13..49f6358 100644 --- a/atlasaction/action.go +++ b/atlasaction/action.go @@ -444,7 +444,7 @@ func (a *Actions) SchemaPush(ctx context.Context) error { return err } params := &atlasexec.SchemaPushParams{ - Repo: a.GetInput("schema-name"), + Repo: a.GetAtlasURLInput("schema-name"), Description: a.GetInput("description"), Version: a.GetInput("version"), DevURL: a.GetInput("dev-url"), @@ -509,7 +509,7 @@ func (a *Actions) SchemaPlan(ctx context.Context) error { Env: a.GetInput("env"), Vars: a.GetVarsInput("vars"), Context: a.GetRunContext(ctx, tc), - Repo: a.GetInput("schema-name"), + Repo: a.GetAtlasURLInput("schema-name"), DevURL: a.GetInput("dev-url"), From: a.GetArrayInput("from"), To: a.GetArrayInput("to"), @@ -620,7 +620,7 @@ func (a *Actions) SchemaPlanApprove(ctx context.Context) error { Env: params.Env, Vars: params.Vars, Context: a.GetRunContext(ctx, tc), - Repo: a.GetInput("schema-name"), + Repo: a.GetAtlasURLInput("schema-name"), DevURL: a.GetInput("dev-url"), From: a.GetArrayInput("from"), To: a.GetArrayInput("to"), @@ -741,6 +741,15 @@ func (a *Actions) GetDurationInput(name string) time.Duration { return 0 } +// GetAtlasURLInput returns the atlas URL input with the given name. +func (a *Actions) GetAtlasURLInput(name string) string { + v := a.GetInput(name) + if v == "" { + return "" + } + return (&url.URL{Scheme: "atlas", Path: v}).String() +} + // GetVarsInput returns the vars input with the given name. // The input should be a JSON string. // Example: