How to Setup Database CI/CD with GitHub, Part 1: Enable SQL Review with GitHub Actions

Estimated: 15 mins
How to Setup Database CI/CD with GitHub, Part 1: Enable SQL Review with GitHub Actions

A series of articles about Database CI/CD with GitHub

In the last article The Database CI/CD Best Practice with GitHub, we raised a question: "can we treat database the same way we treat application code?" and presented a complete database CI/CD workflow with GitHub.

To bring the idea into reality, we broke it down into a three-part tutorial series How to Setup Database CI/CD with GitHub:

  1. Enable SQL Review with GitHub Actions (this one)
  2. Database GitOps
  3. Put Them Together

You can choose to implement GitHub actions, GitOps, or both by following all three.

This first article will guide you to enable SQL Review GitHub actions (developed by Bytebase) when there is a pull request in your repository.

Bytebase deployment is not needed for this tutorial.


Here is a completed example repository:

Step 1 - Create a Repository on GitHub with two folders

  • .github/workflows/ to put the configuration files
  • github-action-test/ to put the test SQLs, actually you can name the folder whatever you want.


Step 2 - Download the SQL review guide template

  1. Go to, and choose Dev.


  1. Filter with MySQL, now you have all the available SQL review rules. Click Download as YAML and you will get a YAML file called sql-review.yml. Rename it to


  1. Move the file under your repo's root directory. Theoretically, you can put it anywhere within the project (just to make sure it's outside of .github/).


Step 3 - Configure sql-review.yml

  1. Go to SQL Review GitHub Action on GitHub marketplace, and follow the Usage section: Create a file sql-review.yml under the .github/workflows folder, and paste the content template.


  1. Configure the file to fit your need.


Step 4 - Open a PR (Pull Request) to trigger the SQL Review Github Actions

  1. Create a new branch.


  1. Add a .sql file under the github-action-test folder.


  1. Commit and push, then create a PR on GitHub. The SQL review will run automatically.


  1. Click on Actions tab, and you will see there are two warnings regarding this particular SQL.


  1. Because they’re warning level, you can still merge the PR.


  1. However, if you want this “fail” to block the merge, you can do either of the following:


  • Or edit the level field on the review rule list directly in your YAML file.


Congratulations! Now you have enabled SQL Review GitHub Actions for your GitHub repo. In the next part of this series, we’ll explore part 2: Database GitOps.

Ready to try out this Database CI/CD workflow yourself? Join our Discord channel and share your experience.

Edit this page on GitHub

Subscribe to Newsletter

By subscribing, you agree with Bytebase's Terms of Service and Privacy Policy.