Skip to content

perfectpanel/sql-review-action

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Изменено в Fork-е

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.

Usage

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

on: [pull_request]

jobs:
  sql-review:
    runs-on: ubuntu-latest
    name: SQL Review
    steps:
      - uses: actions/checkout@v3
      - name: Check SQL
        # You can change it to a specific version like bytebase/[email protected]
        # We suggest using the latest version through the tag. Check it at https://github.com/Bytebase/sql-review-action/tags
        uses: bytebase/sql-review-action@main
        with:
          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, POSTGRES or TIDB.
  • 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 bb.sql-review.prod or bb.sql-review.dev. 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$.

Examples

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

example

About

The GitHub Action for SQL Review.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%