diff --git a/atlasaction/action.go b/atlasaction/action.go index 00ad4f52..2bb455b8 100644 --- a/atlasaction/action.go +++ b/atlasaction/action.go @@ -29,11 +29,22 @@ var Version string // MigrateApply runs the GitHub Action for "ariga/atlas-action/migrate/apply". func MigrateApply(ctx context.Context, client *atlasexec.Client, act *githubactions.Action) error { + dryRun, err := func() (bool, error) { + inp := act.GetInput("dry-run") + if inp == "" { + return false, nil + } + return strconv.ParseBool(inp) + }() + if err != nil { + return fmt.Errorf(`invlid value for the "dry-run" input: %w`, err) + } params := &atlasexec.MigrateApplyParams{ URL: act.GetInput("url"), DirURL: act.GetInput("dir"), ConfigURL: act.GetInput("config"), Env: act.GetInput("env"), + DryRun: dryRun, TxMode: act.GetInput("tx-mode"), // Hidden param. BaselineVersion: act.GetInput("baseline"), // Hidden param. Context: &atlasexec.DeployRunContext{ diff --git a/migrate/apply/action.yml b/migrate/apply/action.yml index 407b9f6a..10c5c1db 100644 --- a/migrate/apply/action.yml +++ b/migrate/apply/action.yml @@ -21,6 +21,9 @@ inputs: env: description: The environment to use from the Atlas configuration file. For example, `dev`. required: false + dry-run: + description: Print SQL without executing it. Either "true" or "false". + required: false outputs: current: description: The current version of the database. (before applying migrations)