Skip to content

GitHub Action

SQL Review

1.1.0 Latest version

SQL Review


SQL Review

Parse and check the SQL statement according to the SQL review rules


Copy and paste the following snippet into your .yml file.


- name: SQL Review

uses: bytebase/sql-review-action@1.1.0

Learn more about this action in bytebase/sql-review-action
Choose a version

SQL Review Action

The GitHub Action for SQL Review. Parse and check the SQL statement according to the SQL review rules to detect SQL anti-patterns and enforce schema consistency across the organization.


Create a file in .github/workflows/sql-review.yml in your repository and insert the following content:

on: [pull_request]

    runs-on: ubuntu-latest
    name: SQL Review
      - uses: actions/checkout@v3
      - name: Check SQL
        # You can change it to a specific version like bytebase/sql-review-action@0.0.4
        # We suggest using the latest version through the tag. Check it at
        uses: bytebase/sql-review-action@main
          override-file-path: "<Your SQL review rules configuration file path>"
          template-id: "<SQL review rule template id>"
          database-type: "<The database type>"
          file-pattern: "<The file pattern for your SQL files>"

The action will be triggered in any pull request which has SQL files changed. It will call the SQL review service to check if the change is valid according to the SQL review rules.

About parameters

  • database-type: Required. The database type, should be one of:
    • MYSQL
    • TIDB
    • ORACLE
    • MSSQL
  • override-file-path: Optional. Your SQL review rules configuration file path. You can configure and generate this file in Bytebase SQL Review Guide page. You can ignore this parameter and only provide the template-id if you don't want to customize rules.
  • template-id: Optional. The SQL Review rule template id, should be one of or You can ignore this parameter if you provide the override-file-path parameter.
  • file-pattern: Optional. The file path regex pattern for your SQL files. Defaults ^.*\.sql$. For example, if you only want to subscribe to the SQL file changes in the db folder, you can set this parameter to ^db/.*\.sql$.


Once you configure the action, you can get these error or warning message based on your SQL review rules: