Skip to content

Commit

Permalink
all: update actions inputs/outputs (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
giautm authored Sep 18, 2024
1 parent 1449122 commit c58bc5e
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 130 deletions.
5 changes: 1 addition & 4 deletions atlasaction/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,6 @@ func (a *Actions) SchemaTest(ctx context.Context) error {

// SchemaPlan runs the GitHub Action for "ariga/atlas-action/schema/plan"
func (a *Actions) SchemaPlan(ctx context.Context) error {
err := a.RequiredInputs("config", "env")
if err != nil {
return err
}
tc, err := a.GetTriggerContext()
if err != nil {
return fmt.Errorf("unable to get the trigger context: %w", err)
Expand All @@ -505,6 +501,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"),
DevURL: a.GetInput("dev-url"),
From: a.GetArrayInput("from"),
To: a.GetArrayInput("to"),
Expand Down
26 changes: 13 additions & 13 deletions migrate/apply/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ branding:
icon: database
author: 'Ariga'
inputs:
url:
description: "The URL of the target database. For example: `mysql://root:pass@localhost:3306/dev`."
required: false
dir:
description: |
The URL of the migration directory to apply. For example: `atlas://dir-name` for cloud
based directories or `file://migrations` for local ones.
working-directory:
description: Atlas working directory, default is project root
required: false
config:
description: |
Expand All @@ -21,17 +16,22 @@ 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
working-directory:
description: Atlas working directory, default is project root
required: false
vars:
description: |
A JSON object containing variables to be used in the Atlas configuration file.
For example, `{"var1": "value1", "var2": "value2"}`.
required: false
url:
description: "The URL of the target database. For example: `mysql://root:pass@localhost:3306/dev`."
required: false
dir:
description: |
The URL of the migration directory to apply. For example: `atlas://dir-name` for cloud
based directories or `file://migrations` for local ones.
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)
Expand Down
34 changes: 17 additions & 17 deletions migrate/down/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,35 @@ branding:
icon: database
author: 'Ariga'
inputs:
url:
description: "The URL of the target database. For example: `mysql://root:pass@localhost:3306/dev`."
required: false
dir:
description: |
The URL of the migration directory to apply. For example: `atlas://dir-name` for cloud
based directories or `file://migrations` for local ones.
working-directory:
description: Atlas working directory, default is project root.
required: false
config:
description: |
The URL of the Atlas configuration file. By default, Atlas will look for a file
named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.
Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).
required: false
env:
description: The environment to use from the Atlas configuration file. For example, `dev`.
required: false
vars:
description: |
A JSON object containing variables to be used in the Atlas configuration file.
For example, `{"var1": "value1", "var2": "value2"}`.
required: false
dev-url:
description: |
The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.
Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).
required: true
env:
description: The environment to use from the Atlas configuration file. For example, `dev`.
url:
description: "The URL of the target database. For example: `mysql://root:pass@localhost:3306/dev`."
required: false
dir:
description: |
The URL of the migration directory to apply. For example: `atlas://dir-name` for cloud
based directories or `file://migrations` for local ones.
required: false
amount:
description: The amount of applied migrations to revert. Mutually exclusive with `to-tag` and `to-version`.
Expand All @@ -35,20 +43,12 @@ inputs:
to-tag:
description: The tag to revert to. Mutually exclusive with `amount` and `to-version`.
required: false
working-directory:
description: Atlas working directory, default is project root.
required: false
wait-interval:
description: Time in seconds between different migrate down attempts.
default: 1s
wait-timeout:
description: Time after which no other retry attempt is made and the action exits.
required: false
vars:
description: |
A JSON object containing variables to be used in the Atlas configuration file.
For example, `{"var1": "value1", "var2": "value2"}`.
required: false
outputs:
current:
description: The current version of the database. (before applying migrations)
Expand Down
30 changes: 15 additions & 15 deletions migrate/lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,8 @@ branding:
icon: database
author: 'Ariga'
inputs:
dir:
description: |
The URL of the migration directory to lint. For example: `file://migrations`.
Read more about [Atlas URLs](https://atlasgo.io/concepts/url).
required: false
dir-name:
description: The name (slug) of the project in Atlas Cloud.
required: true
dev-url:
description: |
The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.
Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).
working-directory:
description: Atlas working directory, default is project root
required: false
config:
description: |
Expand All @@ -26,14 +16,24 @@ inputs:
env:
description: The environment to use from the Atlas configuration file. For example, `dev`.
required: false
working-directory:
description: Atlas working directory, default is project root
required: false
vars:
description: |
A JSON object containing variables to be used in the Atlas configuration file.
For example, `{"var1": "value1", "var2": "value2"}`.
required: false
dev-url:
description: |
The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.
Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).
required: false
dir:
description: |
The URL of the migration directory to lint. For example: `file://migrations`.
Read more about [Atlas URLs](https://atlasgo.io/concepts/url).
required: false
dir-name:
description: The name (slug) of the project in Atlas Cloud.
required: true
outputs:
url:
description: |
Expand Down
44 changes: 22 additions & 22 deletions migrate/push/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,36 @@ branding:
icon: database
author: "Ariga"
inputs:
dir:
working-directory:
description: Atlas working directory, default is project root
required: false
config:
description: |
The URL of the migration directory to push. For example: `file://migrations`.
Read more about [Atlas URLs](https://atlasgo.io/concepts/url).
The path to the Atlas configuration file. By default, Atlas will look for a file
named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.
Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).
required: false
dir-name:
description: The name (slug) of the project in Atlas Cloud.
env:
description: The environment to use from the Atlas configuration file. For example, `dev`.
required: false
vars:
description: |
A JSON object containing variables to be used in the Atlas configuration file.
For example, `{"var1": "value1", "var2": "value2"}`.
required: false
dev-url:
description: |
The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.
Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).
required: false
dir:
description: |
The URL of the migration directory to push. For example: `file://migrations`.
Read more about [Atlas URLs](https://atlasgo.io/concepts/url).
required: false
dir-name:
description: The name (slug) of the project in Atlas Cloud.
required: false
tag:
description: |
The tag to apply to the pushed migration directory. By default the
Expand All @@ -27,23 +44,6 @@ inputs:
If true, push also to the "latest" tag.
default: "true"
required: false
config:
description: |
The path to the Atlas configuration file. By default, Atlas will look for a file
named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.
Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).
required: false
env:
description: The environment to use from the Atlas configuration file. For example, `dev`.
required: false
working-directory:
description: Atlas working directory, default is project root
required: false
vars:
description: |
A JSON object containing variables to be used in the Atlas configuration file.
For example, `{"var1": "value1", "var2": "value2"}`.
required: false
runs:
using: node20
main: index.js
34 changes: 17 additions & 17 deletions migrate/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,8 @@ branding:
icon: database
author: 'Ariga'
inputs:
dev-url:
description: |
The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.
Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).
required: false
dir:
description: |
The URL of the migration directory to apply. For example: `atlas://dir-name` for cloud
based directories or `file://migrations` for local ones.
required: false
run:
description: |
Filter tests to run by regexp. For example, `^test_.*` will only run tests that start with `test_`.
Default is to run all tests.
working-directory:
description: Atlas working directory, default is project root
required: false
config:
description: |
Expand All @@ -28,14 +16,26 @@ inputs:
env:
description: The environment to use from the Atlas configuration file. For example, `dev`.
required: false
working-directory:
description: Atlas working directory, default is project root
required: false
vars:
description: |
A JSON object containing variables to be used in the Atlas configuration file.
For example, `{"var1": "value1", "var2": "value2"}`.
required: false
dev-url:
description: |
The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.
Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).
required: false
dir:
description: |
The URL of the migration directory to apply. For example: `atlas://dir-name` for cloud
based directories or `file://migrations` for local ones.
required: false
run:
description: |
Filter tests to run by regexp. For example, `^test_.*` will only run tests that start with `test_`.
Default is to run all tests.
required: false
runs:
using: node20
main: index.js
3 changes: 3 additions & 0 deletions schema/apply/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ inputs:
description: Automatically approve and apply changes. Either "true" or "false".
required: false
default: "false"
outputs:
error:
description: The error message if the action fails.
runs:
using: node20
main: index.js
8 changes: 5 additions & 3 deletions schema/plan/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Schema Plan'
description: 'Deploy schema changes with Atlas'
description: 'Plan a declarative migration to move from the current state to the desired state'
branding:
icon: database
author: 'Ariga'
Expand All @@ -12,8 +12,7 @@ inputs:
The URL of the Atlas configuration file. By default, Atlas will look for a file
named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.
Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).
required: true
default: "file://atlas.hcl"
required: false
env:
description: The environment to use from the Atlas configuration file. For example, `dev`.
required: false
Expand All @@ -27,6 +26,9 @@ inputs:
The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.
Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).
required: false
schema-name:
description: The name (slug) of the project in Atlas Cloud.
required: false
from:
description: |
URL(s) of the current schema state.
Expand Down
Loading

0 comments on commit c58bc5e

Please sign in to comment.