diff --git a/.github/workflows/sql-review-action.yml b/.github/workflows/sql-review-action.yml new file mode 100644 index 0000000..4377f60 --- /dev/null +++ b/.github/workflows/sql-review-action.yml @@ -0,0 +1,27 @@ +name: SQL review on pull request using bytebase-action image + +on: + pull_request: + branches: + - main + paths: + - "migrations/*.sql" + +jobs: + check-release-on-prod: + permissions: + pull-requests: write # write permission required to allow the action writes the check results to the comment. + runs-on: ubuntu-latest # use self-hosted machines if your Bytebase runs in internal networks. + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Check release + uses: docker://bytebase/bytebase-action:latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set GITHUB_TOKEN because the 'Check release' step needs it to comment the pull request with check results. + BYTEBASE_URL: https://demo.bytebase.com + BYTEBASE_SERVICE_ACCOUNT: ci@service.bytebase.com + BYTEBASE_SERVICE_ACCOUNT_SECRET: ${{secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET}} + BYTEBASE_PROJECT: "projects/project-sample" + BYTEBASE_TARGETS: "instances/prod-sample-instance/databases/hr_prod" + FILE_PATTERN: "migrations/*.sql" diff --git a/migrations/202504171429_1.sql b/migrations/202504171429_1.sql new file mode 100644 index 0000000..89cfa57 --- /dev/null +++ b/migrations/202504171429_1.sql @@ -0,0 +1,3 @@ +CREATE TABLE IF NOT EXISTS wer ( + id int +); \ No newline at end of file diff --git a/migrations/202504171526_2.sql b/migrations/202504171526_2.sql new file mode 100644 index 0000000..6cceccc --- /dev/null +++ b/migrations/202504171526_2.sql @@ -0,0 +1,3 @@ +CREATE TABLE IF NOT EXISTS oijoir ( + id int +); \ No newline at end of file