{"id":18842879,"url":"https://github.com/ariga/atlas-action","last_synced_at":"2026-02-15T21:11:52.705Z","repository":{"id":56768349,"uuid":"524637537","full_name":"ariga/atlas-action","owner":"ariga","description":"GitHub Actions for Atlas","archived":false,"fork":false,"pushed_at":"2026-02-12T08:56:56.000Z","size":3265,"stargazers_count":39,"open_issues_count":1,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-02-12T14:44:27.928Z","etag":null,"topics":["ci","database","migrations"],"latest_commit_sha":null,"homepage":"https://atlasgo.io/integrations/github-actions","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ariga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-08-14T10:25:06.000Z","updated_at":"2026-02-12T07:18:38.000Z","dependencies_parsed_at":"2023-09-23T18:43:52.544Z","dependency_job_id":"2390a644-e5aa-459c-923f-9e26cfa80e30","html_url":"https://github.com/ariga/atlas-action","commit_stats":{"total_commits":248,"total_committers":12,"mean_commits":"20.666666666666668","dds":0.6935483870967742,"last_synced_commit":"c54b5f2c9164d5a4da39cd5c7328c03e9f961aa8"},"previous_names":[],"tags_count":110,"template":false,"template_full_name":null,"purl":"pkg:github/ariga/atlas-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariga%2Fatlas-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariga%2Fatlas-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariga%2Fatlas-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariga%2Fatlas-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ariga","download_url":"https://codeload.github.com/ariga/atlas-action/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariga%2Fatlas-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29489601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T19:29:10.908Z","status":"ssl_error","status_checked_at":"2026-02-15T19:29:10.419Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci","database","migrations"],"created_at":"2024-11-08T02:55:56.564Z","updated_at":"2026-02-15T21:11:52.676Z","avatar_url":"https://github.com/ariga.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Actions for Atlas\n\nThis repository contains GitHub Actions for working with [Atlas](https://atlasgo.io).\n\nTo learn more about the recommended way to build workflows, read our guide on \n[Modern CI/CD for Databases](https://atlasgo.io/guides/modern-database-ci-cd).\n\n## Actions\n\n| Action                                                                        | Description                                                                         |\n|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|\n| [ariga/setup-atlas](#arigasetup-atlas)                                        | Setup the Atlas CLI and optionally login to Atlas Cloud                             |\n| [ariga/atlas-action/copilot](#arigaatlas-actioncopilot) | Talk to Atlas Copilot. |\n| [ariga/atlas-action/migrate/apply](#arigaatlas-actionmigrateapply) | Applies a migration directory on a target database |\n| [ariga/atlas-action/migrate/autorebase](#arigaatlas-actionmigrateautorebase) | Automatically resolves `atlas.sum` conflicts and rebases the migration directory onto the target branch. |\n| [ariga/atlas-action/migrate/hash](#arigaatlas-actionmigratehash) | Automatically generate a hash of the schema migrations directory, and commit it to the migration directory. |\n| [ariga/atlas-action/migrate/diff](#arigaatlas-actionmigratediff) | Automatically generate versioned migrations whenever the schema is changed, and commit them to the migration directory. |\n| [ariga/atlas-action/migrate/down](#arigaatlas-actionmigratedown) | Reverts deployed migration files on a target database |\n| [ariga/atlas-action/migrate/lint](#arigaatlas-actionmigratelint) | CI for database schema changes with Atlas |\n| [ariga/atlas-action/migrate/push](#arigaatlas-actionmigratepush) | Push the current version of your migration directory to Atlas Cloud. |\n| [ariga/atlas-action/migrate/test](#arigaatlas-actionmigratetest) | CI for database schema changes with Atlas |\n| [ariga/atlas-action/monitor/schema](#arigaatlas-actionmonitorschema) | Sync the database schema to Atlas Cloud. |\n| [ariga/atlas-action/schema/apply](#arigaatlas-actionschemaapply) | Applies schema changes to a target database |\n| [ariga/atlas-action/schema/lint](#arigaatlas-actionschemalint) | Lint database schema with Atlas |\n| [ariga/atlas-action/schema/plan](#arigaatlas-actionschemaplan) | Plan a declarative migration to move from the current state to the desired state |\n| [ariga/atlas-action/schema/plan/approve](#arigaatlas-actionschemaplanapprove) | Approve a migration plan by its URL |\n| [ariga/atlas-action/schema/push](#arigaatlas-actionschemapush) | Push a schema version with an optional tag to Atlas |\n| [ariga/atlas-action/schema/test](#arigaatlas-actionschematest) | Run schema tests against the desired schema |\n\n## Examples\n\nThe Atlas GitHub Actions can be composed into workflows to create CI/CD pipelines for your database schema.\nWorkflows will normally begin with the `setup-atlas` action, which will install the Atlas CLI and optionally\nlogin to Atlas Cloud. Followed by whatever actions you need to run, such as `migrate lint` or `migrate apply`.\n\n### Pre-requisites\n\nThe following examples require you to have an Atlas Cloud account and push an initial version of your\nmigration directory.\n\nTo create an account, first download the Atlas CLI (on Linux/macOS):\n\n```bash\ncurl -sSL https://atlasgo.io/install | sh\n```\nFor more installation options, see the [documentation](https://atlasgo.io/getting-started#installation).\n\nThen, create an account by running the following command and following the instructions:\n\n```bash\natlas login\n```\n\nAfter logging in, push your migration directory to Atlas Cloud:\n\n```bash\natlas migrate push --dev-url docker://mysql/8/dev --dir-name my-project\n```\n\nFor a more detailed guide, see the [documentation](https://atlasgo.io/versioned/intro#pushing-migrations-to-atlas).\n\nFinally, you will need an API token to use the Atlas GitHub Actions. To create a token, see \nthe [docs](https://atlasgo.io/cloud/bots).\n\n### Continuous Integration and Delivery\n\nThis example workflow shows how to configure a CI/CD pipeline for your database schema. The workflow will\nverify the safety of your schema changes when in a pull request and push migrations to Atlas Cloud when\nmerged into the main branch.\n\n#### Quick Setup: Using the `gh` CLI\n\nIf you have the [gh](https://cli.github.com/) CLI installed, you can use the following command to\nsetup a workflow for your repository:\n\n```bash\ngh extension install ariga/gh-atlas\ngh auth refresh -s write:packages,workflow\ngh atlas init-action\n```\n\nThis will create a pull request with a workflow that will run `migrate lint` on pull requests and\n`migrate push` on the main branch. You can customize the workflow by editing the generated\n`.github/workflows/atlas-ci.yaml` file.\n\n#### Manual Setup: Create a workflow\n\nCreate a new file named `.github/workflows/atlas.yaml` with the following contents:\n\n```yaml\nname: Atlas CI/CD\non:\n  push:\n    branches:\n      - master # Use your main branch here.\n  pull_request:\n    paths:\n      - 'migrations/*' # Use the path to your migration directory here.\n# Permissions to write comments on the pull request.\npermissions:\n  contents: read\n  pull-requests: write\njobs:\n  atlas:\n    services:\n      # Spin up a mysql:8 container to be used as the dev-database for analysis.\n      mysql:\n        image: mysql:8\n        env:\n          MYSQL_DATABASE: dev\n          MYSQL_ROOT_PASSWORD: pass\n        ports:\n          - 3306:3306\n        options: \u003e-\n          --health-cmd \"mysqladmin ping -ppass\"\n          --health-interval 10s\n          --health-start-period 10s\n          --health-timeout 5s\n          --health-retries 10\n    runs-on: ubuntu-latest\n    env:\n      GITHUB_TOKEN: ${{ github.token }}\n    steps:\n      - uses: actions/checkout@v3\n        with:\n          fetch-depth: 0\n      - uses: ariga/setup-atlas@v0\n        with:\n          cloud-token: ${{ secrets.ATLAS_TOKEN }}\n      - uses: ariga/atlas-action/migrate/lint@v1\n        with:\n          dir: 'file://migrations'\n          dir-name: 'my-project' # The name of the project in Atlas Cloud\n          dev-url: \"mysql://root:pass@localhost:3306/dev\"\n      - uses: ariga/atlas-action/migrate/push@v1\n        if: github.ref == 'refs/heads/master'\n        with:\n          dir: 'file://migrations'\n          dir-name: 'my-project' \n          dev-url: 'mysql://root:pass@localhost:3306/dev' # Use the service name \"mysql\" as the hostname\n```\n\nThis example uses a MySQL database, but you can use any database supported by Atlas.  \nFor more examples, see the [documentation](https://atlasgo.io/integrations/github-actions).\n\n### Continuous Deployment\n\nThis example workflow shows how to configure a continuous deployment pipeline for your database schema. The workflow will\napply migrations on the target database whenever a new commit is pushed to the main branch.\n\n```yaml\nname: Atlas Continuous Deployment\non:\n  push:\n    branches:\n      - master\njobs:\n  apply:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n        with:\n          fetch-depth: 0\n      - uses: ariga/setup-atlas@v0\n        with:\n          cloud-token: ${{ secrets.ATLAS_TOKEN }}\n      - uses: ariga/atlas-action/migrate/apply@v1\n        with:\n          url: 'mysql://user:${{ secrets.DB_PASSWORD }}@db.hostname.io:3306/db'\n          dir: 'atlas://my-project' # A directory stored in Atlas Cloud, use ?tag=\u003ctag\u003e to specify a tag\n```\n\nThis example workflow shows how to configure a deployment pipeline for your database schema. \nThis workflow will pull the most recent version of your migration directory from Atlas Cloud\nand apply it to the target database.\n\nFor more examples, see the [documentation](https://atlasgo.io/integrations/github-actions).\n\n## API \n\n### `ariga/setup-atlas`\n\nSetup the Atlas CLI and optionally login to Atlas Cloud.\n\n#### Inputs\n* `cloud-token` - (Optional) The Atlas Cloud token to use for authentication. To create\n   a cloud token see the [docs](https://atlasgo.io/cloud/bots).\n* `version` - (Optional) The version of the Atlas CLI to install. Defaults to the latest\n   version.\n* `flavor` - (Optional) The driver flavor to install. Some drivers require custom binaries like (\"snowflake\", \"spanner\").\n\n### `ariga/atlas-action/migrate/push`\n\nPush the current version of your migration directory to Atlas Cloud.\n\n#### Inputs\n\nAll inputs are optional as they may be specified in the Atlas configuration file.\n\n* `dir` - The URL of the migration directory to push. For example: `file://migrations`.\n  Read more about [Atlas URLs](https://atlasgo.io/concepts/url).\n* `dir-name` - The name (slug) of the project in Atlas Cloud.\n* `latest` - If true, push also to the `latest` tag.\n* `revisions-schema` - The name of the schema containing the revisions table.\n* `tag` - The tag to apply to the pushed migration directory. By default the\n  current git commit hash is used.\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n* `vars` - A JSON object containing variables to be used in the Atlas configuration file.\n  For example, `{\"var1\": \"value1\", \"var2\": \"value2\"}`.\n* `dev-url` - The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.\n  Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).\n\n### `ariga/atlas-action/migrate/lint`\n\nLint migration changes with Atlas\n\n#### Inputs\n\nAll inputs are optional as they may be specified in the Atlas configuration file.\n\n* `dir` - The URL of the migration directory to lint. For example: `file://migrations`.\n  Read more about [Atlas URLs](https://atlasgo.io/concepts/url).\n* `dir-name` - (Required) The name (slug) of the project in Atlas Cloud.\n* `git-base` - The base branch to detected changes from.\n* `git-dir` - The URL of the git directory to push to. Defaults to the current working directory.\n* `revisions-schema` - The name of the schema containing the revisions table.\n* `tag` - The tag of migrations to used as base for linting. By default, the `latest` tag is used.\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n* `vars` - A JSON object containing variables to be used in the Atlas configuration file.\n  For example, `{\"var1\": \"value1\", \"var2\": \"value2\"}`.\n* `dev-url` - The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.\n  Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).\n\n#### Outputs\n\n* `url` - The URL of the CI report in Atlas Cloud, containing an ERD visualization \n  and analysis of the schema migrations.\n\n### `ariga/atlas-action/migrate/apply`\n\nApply migrations to a database.\n\n#### Inputs\n\nAll inputs are optional as they may be specified in the Atlas configuration file.\n\n* `allow-dirty` - Allow working on a non-clean database.\n* `amount` - The maximum number of migration files to apply. Default is all.\n* `dir` - The URL of the migration directory to apply. For example: `atlas://dir-name` for cloud\n  based directories or `file://migrations` for local ones.\n* `dry-run` - Print SQL without executing it. Either \"true\" or \"false\".\n* `revisions-schema` - The name of the schema containing the revisions table.\n* `to-version` - The target version to apply migrations to. Mutually exclusive with `amount`.\n* `tx-mode` - Transaction mode to use. Either \"file\", \"all\", or \"none\".\n* `url` - The URL of the target database. For example: `mysql://root:pass@localhost:3306/dev`.\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n* `vars` - A JSON object containing variables to be used in the Atlas configuration file.\n  For example, `{\"var1\": \"value1\", \"var2\": \"value2\"}`.\n\n#### Outputs\n\n* `applied_count` - The number of migrations that were applied.\n* `current` - The current version of the database. (before applying migrations)\n* `pending_count` - The number of migrations that will be applied.\n* `runs` - A JSON array of objects containing the current version, target version,\n  applied count, and pending count for each migration run.\n* `target` - The target version of the database.\n\n### `ariga/atlas-action/migrate/down`\n\nRevert migrations to a database.\n\n#### Inputs\n\nAll inputs are optional as they may be specified in the Atlas configuration file.\n\n* `amount` - The amount of applied migrations to revert. Mutually exclusive with `to-tag` and `to-version`.\n* `dir` - The URL of the migration directory to apply. For example: `atlas://dir-name` for cloud\n  based directories or `file://migrations` for local ones.\n* `revisions-schema` - The name of the schema containing the revisions table.\n* `to-tag` - The tag to revert to. Mutually exclusive with `amount` and `to-version`.\n* `to-version` - The version to revert to. Mutually exclusive with `amount` and `to-tag`.\n* `url` - The URL of the target database. For example: `mysql://root:pass@localhost:3306/dev`.\n* `wait-interval` - Time in seconds between different migrate down attempts.\n* `wait-timeout` - Time after which no other retry attempt is made and the action exits.\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n* `vars` - A JSON object containing variables to be used in the Atlas configuration file.\n  For example, `{\"var1\": \"value1\", \"var2\": \"value2\"}`.\n* `dev-url` - The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.\n  Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).\n\n#### Outputs\n\n* `current` - The current version of the database. (before applying migrations)\n* `planned_count` - The number of migrations that will be applied.\n* `reverted_count` - The number of migrations that were reverted.\n* `target` - The target version of the database.\n* `url` - If given, the URL for reviewing the revert plan.\n\n### `ariga/atlas-action/migrate/test`\n\nRun schema migration tests. Read more in [Atlas website](https://atlasgo.io/testing/migrate).\n\n#### Inputs\n\nAll inputs are optional as they may be specified in the Atlas configuration file.\n\n* `dir` - The URL of the migration directory to apply. For example: `atlas://dir-name` for cloud\n  based directories or `file://migrations` for local ones.\n* `paths` - List of directories containing test files.\n* `revisions-schema` - The name of the schema containing the revisions table.\n* `run` - Filter tests to run by regexp.\n  For example, `^test_.*` will only run tests that start with `test_`.\n  Default is to run all tests.\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n* `vars` - A JSON object containing variables to be used in the Atlas configuration file.\n  For example, `{\"var1\": \"value1\", \"var2\": \"value2\"}`.\n* `dev-url` - The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.\n  Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).\n\n### `ariga/atlas-action/migrate/autorebase`\n\nAutomatically resolves `atlas.sum` conflicts and rebases the migration directory onto the target branch. \n\n\u003e **Note**\n\u003e \n\u003e Users should set the `migrate/lint` action to ensure no logical conflicts occur after this action.\n\u003e \n\u003e After the rebase is done and a commit is pushed by the action, no other workflows will be triggered unless the action is running with a personal access token (PAT).\n\u003e```\n\u003e   - uses: actions/checkout@v4\n\u003e     with:\n\u003e       token: ${{ secrets.PAT }}\n\u003e```\n\n\n#### Inputs\n\nAll inputs are optional\n\n* `base-branch` - The base branch to rebase the migration directory onto. Default to the default branch of the repository.\n* `dir` - The URL of the migration directory to rebase on. By default: `file://migrations`.\n* `remote` - The remote to fetch from. Defaults to `origin`.\n* `working-directory` - Atlas working directory. Default is project root\n\n#### Example usage\n\nAdd the next job to your workflow to automatically rebase migrations on top of the migration directory in case of conflicts:\n\n```yaml\nname: Rebase Atlas Migrations\non:\n  # Run on push event and not pull request because github action does not run when there is a conflict in the PR.\n  push:\n    branches-ignore:\n      - master\njobs:\n  migrate-auto-rebase:\n    permissions:\n      # Allow pushing changes to repo\n      contents: write\n    runs-on: ubuntu-latest\n    steps:\n    - uses: ariga/setup-atlas@v0\n      with:\n        cloud-token: ${{ secrets.ATLAS_TOKEN }}\n    - uses: actions/checkout@v4\n      with:\n        # Use personal access token to trigger workflows after commits are pushed by the action.\n        token: ${{ secrets.PAT }}\n        # Need to fetch the branch history for rebase.\n        fetch-depth: 0\n    # Skip the step below if your CI is already configured with a Git account.\n    - name: config git to commit changes\n      run: |\n        git config --local user.email \"github-actions[bot]@users.noreply.github.com\"\n        git config --local user.name \"github-actions[bot]\"\n    - uses: ariga/atlas-action/migrate/autorebase@v1\n      with:\n        base-branch: master\n        dir: file://migrations\n```\n### `ariga/atlas-action/migrate/hash`\n\nAutomatically resolves `atlas.sum` out of sync issues by re-generating the `atlas.sum` file based on the current state of the migration directory.\n\n\u003e **Note**\n\u003e \n\u003e After the rehash is done and a commit is pushed by the action, no other workflows will be triggered unless the action is running with a personal access token (PAT).\n\u003e```\n\u003e   - uses: actions/checkout@v4\n\u003e     with:\n\u003e       token: ${{ secrets.PAT }}\n\u003e```\n\n#### Inputs\n\nAll inputs are optional\n\n* `base-branch` - The base branch to rebase the migration directory onto. Default to the default branch of the repository.\n* `dir` - The URL of the migration directory to hash. By default: `file://migrations`.\n* `remote` - The remote to fetch from. Defaults to `origin`.\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n\n#### Example usage\n\nAdd the next job to your workflow to automatically re-generate the `atlas.sum` file in case it is out of sync with the migration directory:\n\n```yaml\nname: Hash Atlas Migrations\non:\n  pull_request:\njobs:\n  migrate-hash:\n    permissions:\n      # Allow pushing changes to repo\n      contents: write\n    runs-on: ubuntu-latest\n    steps:\n    - uses: ariga/setup-atlas@v0\n      with:\n        cloud-token: ${{ secrets.ATLAS_TOKEN }}\n    - uses: actions/checkout@v4\n      with:\n        # Use personal access token to trigger workflows after commits are pushed by the action.\n        token: ${{ secrets.PAT }}\n        fetch-depth: 0\n    # Skip the step below if your CI is already configured with a Git account.\n    - name: config git to commit changes\n      run: |\n        git config --local user.email \"github-actions[bot]@users.noreply.github.com\"\n        git config --local user.name \"github-actions[bot]\"\n    - uses: ariga/atlas-action/migrate/hash@v1\n      with:\n        dir: file://migrations\n```\n### `ariga/atlas-action/migrate/diff`\n\nAutomatically generate versioned migrations whenever the schema is changed, and commit them to the migration directory.\n\u003e **Note**\n\u003e\n\u003e After committing the changes to the migration directory, no other workflows will be triggered unless the action is run with a personal access token (PAT).\n\u003e```\n\u003e   - uses: actions/checkout@v4\n\u003e     with:\n\u003e       token: ${{ secrets.PAT }}\n\u003e```\n\n#### Inputs\n\n`dir`, `to`  and `dev-url` are required, but they can be specified in the Atlas configuration file via `config` and `env`.\n\n* `dir` - The URL of the migration directory. For example: `file://migrations`.\n  Read more about [Atlas URLs](https://atlasgo.io/concepts/url).\n* `remote` - The remote to push changes to. Defaults to `origin`.\n* `to` - The URL of the desired state.\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n* `vars` - A JSON object containing variables to be used in the Atlas configuration file.\n  For example, `{\"var1\": \"value1\", \"var2\": \"value2\"}`.\n* `dev-url` - The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.\n  Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).\n\n#### Example usage\n\n```yaml\njobs:\n  migrate-diff:\n    permissions:\n      # Allow pushing changes to repo and comments on the pull request\n      contents: write\n      pull-requests: write\n    env:\n      GITHUB_TOKEN: ${{ github.token }}\n    runs-on: ubuntu-latest\n    steps:\n    - uses: ariga/setup-atlas@v0\n      with:\n        cloud-token: ${{ secrets.ATLAS_TOKEN }}\n    - uses: actions/checkout@v4\n      with:\n        # Use personal access token to trigger workflows after commits are pushed by the action.\n        token: ${{ secrets.PAT }}\n        fetch-depth: 0\n    # Skip the step below if your CI is already configured with a Git account.\n    - name: config git to commit changes\n      run: |\n        git config --local user.email \"github-actions[bot]@users.noreply.github.com\"\n        git config --local user.name \"github-actions[bot]\"\n    - uses: ariga/atlas-action/migrate/diff@v1\n      with:\n        dev-url: \"mysql://root:pass@localhost:3306/dev\"\n        dir: file://migrations\n        to:  file://schema.sql # The desired schema state to transition to.\n```\n\n### `ariga/atlas-action/schema/test`\n\nRun schema tests on the desired schema. Read more in [Atlas website](https://atlasgo.io/testing/schema).\n\n#### Inputs\n\nAll inputs are optional as they may be specified in the Atlas configuration file.\n\n* `paths` - List of directories containing test files.\n* `run` - Filter tests to run by regexp.\n  For example, `^test_.*` will only run tests that start with `test_`.\n  Default is to run all tests.\n* `url` - The desired schema URL(s) to test\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n* `vars` - A JSON object containing variables to be used in the Atlas configuration file.\n  For example, `{\"var1\": \"value1\", \"var2\": \"value2\"}`.\n* `dev-url` - The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.\n  Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).\n\n### `ariga/atlas-action/schema/apply`\n\nApply a declarative migrations to a database.\n\n#### Inputs\n\n* `auto-approve` - Automatically approve and apply changes. Either \"true\" or \"false\".\n* `dry-run` - Print SQL without executing it. Either \"true\" or \"false\".\n* `exclude` - List of glob patterns used to select which resources to filter in inspection\n  see: https://atlasgo.io/declarative/inspect#exclude-schemas\n* `include` - List of glob patterns used to select which resources to keep in inspection\n  see: https://atlasgo.io/declarative/inspect#include-schemas\n* `lint-review` - Automatically generate an approval plan before applying changes. Options are \"ALWAYS\", \"ERROR\" or \"WARNING\".\n  Use \"ALWAYS\" to generate a plan for every apply, or \"WARNING\" and \"ERROR\" to generate a plan only based on review policy.\n* `plan` - The plan to apply. For example, `atlas://\u003cschema\u003e/plans/\u003cid\u003e`.\n* `schema` - List of database schema(s). For example: `public`.\n* `to` - URL(s) of the desired schema state.\n* `tx-mode` - Transaction mode to use. Either \"file\", \"all\", or \"none\".\n* `url` - The URL of the target database to apply changes to.\n  For example: `mysql://root:pass@localhost:3306/prod`.\n* `wait-interval` - Time in seconds between different apply attempts.\n* `wait-timeout` - Time after which no other retry attempt is made and the action exits.\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n* `vars` - A JSON object containing variables to be used in the Atlas configuration file.\n  For example, `{\"var1\": \"value1\", \"var2\": \"value2\"}`.\n* `dev-url` - The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.\n  Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).\n\n#### Outputs\n\n* `error` - The error message if the action fails.\n\n### `ariga/atlas-action/schema/lint`\n\nLint database schema with Atlas.\n\n#### Inputs\n\n* `schema` - The database schema(s) to include. For example: `public`.\n* `url` - Schema URL(s) to lint. For example: `file://schema.hcl`.\n  Read more about [Atlas URLs](https://atlasgo.io/concepts/url).\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n* `vars` - A JSON object containing variables to be used in the Atlas configuration file.\n  For example, `{\"var1\": \"value1\", \"var2\": \"value2\"}`.\n* `dev-url` - The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.\n  Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).\n\n### `ariga/atlas-action/schema/push`\n\nPush a schema to [Atlas Registry](https://atlasgo.io/registry) with an optional tag.\n\n#### Inputs\n\n* `description` - The description of the schema.\n* `latest` - If true, push also to the `latest` tag.\n* `schema` - List of database schema(s). For example: `public`.\n* `schema-name` - The name (slug) of the schema repository in Atlas Registry.\n  Read more in Atlas website: https://atlasgo.io/registry.\n* `tag` - The tag to apply to the pushed schema. By default, the current git commit hash is used.\n* `url` - Desired schema URL(s) to push. For example: `file://schema.lt.hcl`.\n* `version` - The version of the schema.\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n* `vars` - A JSON object containing variables to be used in the Atlas configuration file.\n  For example, `{\"var1\": \"value1\", \"var2\": \"value2\"}`.\n* `dev-url` - The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.\n  Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).\n\n\n\n#### Outputs\n\n* `link` - Link to the schema version on Atlas.\n* `slug` - The slug of the pushed schema version.\n* `url` - The URL of the pushed schema version.\n\n\n### `ariga/atlas-action/schema/plan`\n\nPlan a declarative migration for a schema transition.\n\n#### Inputs\n\n* `exclude` - List of glob patterns used to select which resources to filter in inspection\n  see: https://atlasgo.io/declarative/inspect#exclude-schemas\n* `from` - URL(s) of the current schema state. If not provided, Atlas uses the [`url`](https://atlasgo.io/hcl/config#env.url) from the config file.\n  If that is also not set, Atlas defaults to the **last known state in the Atlas Registry** (use [`schema.repo`](https://atlasgo.io/hcl/config#env.schema.repo) from the config file).\n* `include` - List of glob patterns used to select which resources to keep in inspection\n  see: https://atlasgo.io/declarative/inspect#include-schemas\n* `name` - The name of the plan. By default, Atlas will generate a name based on the schema changes.\n* `schema` - List of database schema(s). For example: `public`.\n* `schema-name` - The name (slug) of the schema repository in Atlas Registry.\n  Read more in Atlas website: https://atlasgo.io/registry.\n* `to` - URL(s) of the desired schema state.\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n* `vars` - A JSON object containing variables to be used in the Atlas configuration file.\n  For example, `{\"var1\": \"value1\", \"var2\": \"value2\"}`.\n* `dev-url` - The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.\n  Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).\n\n\n\n#### Outputs\n\n* `link` - Link to the schema plan on Atlas.\n* `plan` - The plan to be applied or generated. (e.g. `atlas://\u003cschema\u003e/plans/\u003cid\u003e`)\n* `status` - The status of the plan. For example, `PENDING` or `APPROVED`.\n\n\n### `ariga/atlas-action/schema/plan/approve`\n\nApprove a declarative migration plan.\n\n#### Inputs\n\n* `exclude` - List of glob patterns used to select which resources to filter in inspection\n  see: https://atlasgo.io/declarative/inspect#exclude-schemas\n* `from` - URL(s) of the current schema state. If not provided, Atlas uses the [`url`](https://atlasgo.io/hcl/config#env.url) from the config file.\n  If that is also not set, Atlas defaults to the **last known state in the Atlas Registry** (use [`schema.repo`](https://atlasgo.io/hcl/config#env.schema.repo) from the config file).\n* `include` - List of glob patterns used to select which resources to keep in inspection\n  see: https://atlasgo.io/declarative/inspect#include-schemas\n* `plan` - The URL of the plan to be approved. For example, `atlas://\u003cschema\u003e/plans/\u003cid\u003e`.\n  If not provided, Atlas will search the registry for a plan corresponding to the given schema transition and approve it\n  (typically, this plan is created during the PR stage). If multiple plans are found, an error will be thrown.\n* `schema` - List of database schema(s). For example: `public`.\n* `schema-name` - The name (slug) of the schema repository in Atlas Registry.\n  Read more in Atlas website: https://atlasgo.io/registry.\n* `to` - URL(s) of the desired schema state.\n* `working-directory` - Atlas working directory. Default is project root\n* `config` - The URL of the Atlas configuration file. By default, Atlas will look for a file\n  named `atlas.hcl` in the current directory. For example, `file://config/atlas.hcl`.\n  Learn more about [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file. For example, `dev`.\n* `vars` - A JSON object containing variables to be used in the Atlas configuration file.\n  For example, `{\"var1\": \"value1\", \"var2\": \"value2\"}`.\n* `dev-url` - The URL of the dev-database to use for analysis. For example: `mysql://root:pass@localhost:3306/dev`.\n  Read more about [dev-databases](https://atlasgo.io/concepts/dev-database).\n\n\n\n#### Outputs\n\n* `link` - Link to the schema plan on Atlas.\n* `plan` - The plan to be applied or generated. (e.g. `atlas://\u003cschema\u003e/plans/\u003cid\u003e`)\n* `status` - The status of the plan. (e.g, `PENDING`, `APPROVED`)\n\n\n### `ariga/atlas-action/monitor/schema`\n\nMonitor changes of the database schema and track them in Atlas Cloud.\nCan be used periodically to [monitor](https://atlasgo.io/monitoring) changes in the database schema.\n\n#### Inputs\n\n* `cloud-token` - (Required) The token that is used to connect to Atlas Cloud (should be passed as a secret).\n* `collect-stats` - Whether to collect and send anonymized usage statistics to Atlas.\n* `exclude` - List of glob patterns used to select which resources to filter in inspection\n  see: https://atlasgo.io/declarative/inspect#exclude-schemas\n* `include` - List of glob patterns used to select which resources to keep in inspection\n  see: https://atlasgo.io/declarative/inspect#include-schemas\n* `schemas` - List of database schemas to include (by default includes all schemas). see: https://atlasgo.io/declarative/inspect#inspect-multiple-schemas\n* `slug` - Optional unique identifier for the database server.\n* `url` - URL of the database to sync (mutually exclusive with `config` and `env`).\n* `config` - The URL of the Atlas configuration file (mutually exclusive with `url`).\n  For example, `file://config/atlas.hcl`, learn more about\n  [Atlas configuration files](https://atlasgo.io/atlas-schema/projects).\n* `env` - The environment to use from the Atlas configuration file.\n  For example, `dev` (mutually exclusive with `url`).\n\n\n\n#### Outputs\n\n* `url` - URL of the schema of the database inside Atlas Cloud.\n\n#### Example usage\n\nThe following action will monitor changes to the `auth` and `app` schemas inside the `mysql://root:pass@localhost:3306` database and track them in Atlas Cloud.\nIn case the database URL is subject to change, the `slug` parameter can use to identify the same database across runs.\n\n```yaml\n        uses: ariga/atlas-action/monitor/schema@v1\n        with:\n          cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}\n          url: 'mysql://root:pass@localhost:3306'\n          schemas: |-\n            auth\n            app\n```\n\n### `ariga/atlas-action/setup`\n\nThis action builds the binary of atlas-action on your pipeline, instead of downloading it from the internet. So you can pin it and other actions to specified commit.\n\n#### Inputs\n\n* `token` - (Optional) The GitHub Token for GitHub Enterprise usage only.\n\n#### Example usage\n\nThe following example demonstrates how to pin the `ariga/atlas-action/setup` action to a specific commit for better security and reproducibility:\n\n```yaml\nname: Setup Atlas CLI\non:\n  push:\n    branches:\n      - main\njobs:\n  migrate-apply:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v3\n      # This action builds the binary locally\n      - uses: ariga/atlas-action/setup@\u003ccommit-sha\u003e\n      # Pin other actions without `atlas-action/setup` won't work\n      - uses: ariga/atlas-action/migrate/apply@\u003ccommit-sha\u003e\n        with:\n          url: 'mysql://user:${{ secrets.DB_PASSWORD }}@db.hostname.io:3306/db'\n          dir: 'atlas://my-project' # A directory stored in Atlas Cloud, use ?tag=\u003ctag\u003e to specify a tag\n```\n\nReplace `\u003ccommit-sha\u003e` with the specific commit hash you want to pin the action to. Pinning to a commit ensures that the action's behavior does not change unexpectedly due to updates in the repository.\n\n### Why Pin Actions to a Commit?\n\nPinning actions to a specific commit provides the following benefits:\n- **Security**: Prevents the action from being modified by unauthorized changes in the repository.\n- **Reproducibility**: Ensures that workflows behave consistently across runs, even if the action is updated in the future.\n\nFor more details, see the [GitHub Actions security best practices](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-third-party-actions).\n\n### Development\n\nTo release the new version of atlas-action, bump the version in `VERSION.txt` and open the Pull Request to the master branch.\n\n### Legal\n\nThe source code for this GitHub Action is released under the Apache 2.0\nLicense, see [LICENSE](LICENSE).\n\nThis action downloads a binary version of [Atlas](https://atlasgo.io) which\nis distributed under the [Ariga EULA](https://ariga.io/legal/atlas/eula).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariga%2Fatlas-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fariga%2Fatlas-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariga%2Fatlas-action/lists"}