Skip to content

Commit c3ed8a5

Browse files
committed
chore: update SQL review github actions
1 parent e747a93 commit c3ed8a5

File tree

6 files changed

+28
-16
lines changed

6 files changed

+28
-16
lines changed

content/docs/sql-review/gitops-ci.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Once you've set up the [GitOps Workflow](/docs/vcs-integration/overview/), your
66

77
## GitHub
88

9+
<TutorialBlock url="/docs/tutorials/sql-review-github-action" title="SQL Review with GitHub Actions" />
10+
911
![github](/content/docs/sql-review/gitops-ci/github-pr-sql-review.webp)
1012

1113
## GitLab

content/docs/tutorials/api-sql-review-policy.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ This tutorial will guide you through configuring SQL review rules using the Byte
1616
This is the 4th part of tutorial series of SQL Review:
1717

1818
1. [SQL Review with Bytebase GUI](/docs/tutorials/sql-review-gui/)
19-
1. SQL Review with CI (TBD)
19+
1. SQL Review with CI:
20+
- [SQL Review with GitHub Actions](/docs/tutorials/sql-review-github-action/)
2021
1. [SQL Review with Bytebase API](/docs/tutorials/sql-review-api/)
2122
1. Codify SQL Review Policies with Bytebase API (this one)
2223

content/docs/tutorials/sql-review-api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ When modifying data in the database, it's crucial to ensure that the changes are
1414
This is the first part of tutorial series of SQL Review:
1515

1616
1. [SQL Review with Bytebase GUI](/docs/tutorials/sql-review-gui/)
17-
1. SQL Review with CI (TBD)
17+
1. SQL Review with CI:
18+
- [SQL Review with GitHub Actions](/docs/tutorials/sql-review-github-action/)
1819
1. SQL Review with Bytebase API (this one)
1920
1. [Codify SQL Review Policies with Bytebase API](/docs/tutorials/api-sql-review-policy/)
2021

content/docs/tutorials/sql-review-github-action.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: 'SQL Review with GitHub Actions'
33
author: Adela
44
updated_at: 2025/03/03 18:15
55
tags: Tutorial
6+
integrations: GitHub
67
level: Intermediate
78
estimated_time: '20 mins'
89
description: Learn how to use SQL Review via GitHub CI to enhance your database schema change process.
@@ -20,9 +21,15 @@ This tutorial is part of the SQL Review series:
2021

2122
This tutorial will show you how to integrate SQL Review with GitHub Actions to improve your database schema change process.
2223

23-
Example repository: [release-cicd-workflows-example](https://github.com/bytebase/release-cicd-workflows-example).
24+
<HintBlock type="info">
2425

25-
For detailed steps on setting up SQL Review in conjunction with database release CI/CD using GitHub Actions, refer to the [Database Release CI/CD with GitHub Actions](/docs/tutorials/github-release-cicd-workflow/) tutorial.
26+
This tutorial code repository is at https://github.com/bytebase/release-cicd-workflows-example
27+
28+
</HintBlock>
29+
30+
## Prerequisites
31+
32+
Configure ngrok and create service account same as [Database Release CI/CD with GitHub Actions](/docs/tutorials/github-release-cicd-workflow/#step-1-start-bytebase-with-ngrok).
2633

2734
## GitHub Action Workflow
2835

@@ -31,12 +38,12 @@ This [bytebase-check-release.yml](https://github.com/bytebase/release-cicd-workf
3138
Configuration snippet:
3239

3340
```yaml
34-
env:
35-
BYTEBASE_URL: "https://demo.bytebase.com"
36-
BYTEBASE_SERVICE_ACCOUNT: "ci@service.bytebase.com"
37-
BYTEBASE_PROJECT: "projects/project-sample"
38-
BYTEBASE_TARGETS: "instances/test-sample-instance/databases/hr_test,instances/prod-sample-instance/databases/hr_prod"
39-
FILE_PATTERN: "migrations/*.sql"
41+
env:
42+
BYTEBASE_URL: 'https://demo.bytebase.com'
43+
BYTEBASE_SERVICE_ACCOUNT: 'ci@service.bytebase.com'
44+
BYTEBASE_PROJECT: 'projects/project-sample'
45+
BYTEBASE_TARGETS: 'instances/test-sample-instance/databases/hr_test,instances/prod-sample-instance/databases/hr_prod'
46+
FILE_PATTERN: 'migrations/*.sql'
4047
```
4148
4249
The deployment target is the database that the SQL files will be applied to. So the SQL Review policy is fetched based on the target database. Visit the [demo sql review policy page](https://demo.bytebase.com/sql-review) to see the `SQL Review Sample Policy` for the `Prod` environment.
@@ -45,23 +52,23 @@ The deployment target is the database that the SQL files will be applied to. So
4552

4653
## Example PR
4754

48-
[Example PR](https://github.com/bytebase/release-cicd-workflows-example/pull/4)cointains four sql files in the `migrations` folder:
55+
[Example PR](https://github.com/bytebase/release-cicd-workflows-example/pull/4) contains four sql files in the `migrations` folder:
4956

5057
- `001__drop_dept_emp.sql`
5158
- `002__add_employee_phone.sql`
5259
- `003__update_employee_gender.sql`
5360
- `004__create_book.sql`
5461

55-
Upon PR creation, the GitHub Action triggers SQL Review. A summary, including affected rows, risk level, and advice, is posted as a PR comment. With four files and two stages, there are eight lines of review results.
62+
Upon PR creation, the GitHub Action triggers SQL Review. A summary, including **affected rows**, **risk level**, and **advices**, is posted as a PR comment. With four files and two stages, there are eight lines of review results.
5663

5764
![gh-sql-review-summary](/content/docs/tutorials/sql-review-github-action/gh-sql-review-summary.webp)
5865

59-
Click the **Files changed** tab for detailed SQL review results per file.
66+
Click the **Files changed** tab for detailed SQL review results posted inlined in the PR.
6067

6168
![gh-file-changed](/content/docs/tutorials/sql-review-github-action/gh-file-changed.webp)
6269

63-
You may correct the SQL files and push again. The SQL Review will be performed again and the results will be updated.
70+
You may correct the SQL files and push again. The SQL Review will be triggered again and the results will be updated.
6471

6572
## Summary
6673

67-
Now you have learned how to trigger SQL Review in GitHub Actions, you may also refer to the [SQL Review](/docs/sql-review/overview) document for more details.
74+
Now you have learned how to trigger SQL Review in GitHub Actions, you may also refer to the [SQL Review](/docs/sql-review/overview) document for more details.

content/docs/tutorials/sql-review-gui.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ When modifying data in the database, it's crucial to ensure that the changes are
1313
This is the 3rd part of tutorial series of SQL Review:
1414

1515
1. SQL Review with Bytebase GUI (this one)
16-
1. SQL Review with CI (TBD)
16+
1. SQL Review with CI:
17+
- [SQL Review with GitHub Actions](/docs/tutorials/sql-review-github-action/)
1718
1. [SQL Review with Bytebase API](/docs/tutorials/sql-review-api/)
1819
1. [Codify SQL Review Policies with Bytebase API](/docs/tutorials/api-sql-review-policy/)
1920

27.3 KB
Loading

0 commit comments

Comments
 (0)