From aadd4cc912b0610f9e4e733cfacc52c37abfb0eb Mon Sep 17 00:00:00 2001 From: p0ny Date: Thu, 17 Apr 2025 14:28:00 +0800 Subject: [PATCH 1/8] test action --- .github/workflows/sql-review-action.yml | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/sql-review-action.yml diff --git a/.github/workflows/sql-review-action.yml b/.github/workflows/sql-review-action.yml new file mode 100644 index 0000000..16df5f7 --- /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-test: + 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/test-sample-instance/databases/hr_test" + FILE_PATTERN: "migrations/*.sql" From b3b91153691744bab60c9522bb32144adbb40167 Mon Sep 17 00:00:00 2001 From: p0ny Date: Thu, 17 Apr 2025 14:30:13 +0800 Subject: [PATCH 2/8] sql --- migrations/202504171429_1.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 migrations/202504171429_1.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 From 8cc8abe3909ff84eb60c9a4b3fabc1c574fab4b9 Mon Sep 17 00:00:00 2001 From: p0ny Date: Thu, 17 Apr 2025 14:34:49 +0800 Subject: [PATCH 3/8] u --- .github/workflows/sql-review-action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sql-review-action.yml b/.github/workflows/sql-review-action.yml index 16df5f7..9fd0385 100644 --- a/.github/workflows/sql-review-action.yml +++ b/.github/workflows/sql-review-action.yml @@ -8,7 +8,7 @@ on: - "migrations/*.sql" jobs: - check-release-on-test: + 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. @@ -23,5 +23,6 @@ jobs: BYTEBASE_SERVICE_ACCOUNT: ci@service.bytebase.com BYTEBASE_SERVICE_ACCOUNT_SECRET: ${{secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET}} BYTEBASE_PROJECT: "projects/project-sample" - BYTEBASE_TARGETS: "instances/test-sample-instance/databases/hr_test" + BYTEBASE_TARGETS: "instances/test-sample-instance/databases/hr_prod" FILE_PATTERN: "migrations/*.sql" + GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} From b4fbe6115d02993f1be3f0fd1539345cff6d6414 Mon Sep 17 00:00:00 2001 From: p0ny Date: Thu, 17 Apr 2025 14:35:52 +0800 Subject: [PATCH 4/8] u --- .github/workflows/sql-review-action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sql-review-action.yml b/.github/workflows/sql-review-action.yml index 9fd0385..16b8620 100644 --- a/.github/workflows/sql-review-action.yml +++ b/.github/workflows/sql-review-action.yml @@ -23,6 +23,6 @@ jobs: BYTEBASE_SERVICE_ACCOUNT: ci@service.bytebase.com BYTEBASE_SERVICE_ACCOUNT_SECRET: ${{secrets.BYTEBASE_SERVICE_ACCOUNT_SECRET}} BYTEBASE_PROJECT: "projects/project-sample" - BYTEBASE_TARGETS: "instances/test-sample-instance/databases/hr_prod" + BYTEBASE_TARGETS: "instances/prod-sample-instance/databases/hr_prod" FILE_PATTERN: "migrations/*.sql" GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} From ef121eb53deaa768032f118f787021796937d6ad Mon Sep 17 00:00:00 2001 From: p0ny Date: Thu, 17 Apr 2025 15:26:58 +0800 Subject: [PATCH 5/8] u --- migrations/202504171526_2.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 migrations/202504171526_2.sql 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 From 9617d336abf398398774b87c012657262a282377 Mon Sep 17 00:00:00 2001 From: p0ny Date: Thu, 17 Apr 2025 16:43:08 +0800 Subject: [PATCH 6/8] u --- .github/workflows/sql-review-action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sql-review-action.yml b/.github/workflows/sql-review-action.yml index 16b8620..85c54ff 100644 --- a/.github/workflows/sql-review-action.yml +++ b/.github/workflows/sql-review-action.yml @@ -15,6 +15,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: print event + run: | + cat $GITHUB_EVENT_PATH - name: Check release uses: docker://bytebase/bytebase-action:latest env: From 5a9954d883966ae45cf6e3892021083bf35f7114 Mon Sep 17 00:00:00 2001 From: p0ny Date: Thu, 17 Apr 2025 16:58:06 +0800 Subject: [PATCH 7/8] Revert "u" This reverts commit 9617d336abf398398774b87c012657262a282377. --- .github/workflows/sql-review-action.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/sql-review-action.yml b/.github/workflows/sql-review-action.yml index 85c54ff..16b8620 100644 --- a/.github/workflows/sql-review-action.yml +++ b/.github/workflows/sql-review-action.yml @@ -15,9 +15,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: print event - run: | - cat $GITHUB_EVENT_PATH - name: Check release uses: docker://bytebase/bytebase-action:latest env: From f6e2a4cfad126558478812de6e2c773fa5f198c8 Mon Sep 17 00:00:00 2001 From: p0ny Date: Thu, 17 Apr 2025 16:58:21 +0800 Subject: [PATCH 8/8] u --- .github/workflows/sql-review-action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/sql-review-action.yml b/.github/workflows/sql-review-action.yml index 16b8620..4377f60 100644 --- a/.github/workflows/sql-review-action.yml +++ b/.github/workflows/sql-review-action.yml @@ -25,4 +25,3 @@ jobs: BYTEBASE_PROJECT: "projects/project-sample" BYTEBASE_TARGETS: "instances/prod-sample-instance/databases/hr_prod" FILE_PATTERN: "migrations/*.sql" - GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}