From 033063050bea4f27967d10bb95574940517f2981 Mon Sep 17 00:00:00 2001 From: JingYu-create520 Date: Tue, 22 Sep 2026 11:51:26 +0800 Subject: [PATCH] dogfood: review our own pull requests with the published Action The README tells people to write uses: JingYu-create520/sql-index-advisor@v0 while the changelog admitted the Action had never run as a check on a real pull request. This workflow is that run, against a demo mapper carrying four known problems. The fixture is named demo-schema.json because schema.json is gitignored on purpose: it is user output, not source. --- .github/workflows/index-review.yml | 35 ++++++++++++++++++++++++ examples/pr-demo/OrderSearchDao.xml | 41 +++++++++++++++++++++++++++++ examples/pr-demo/demo-schema.json | 41 +++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 .github/workflows/index-review.yml create mode 100644 examples/pr-demo/OrderSearchDao.xml create mode 100644 examples/pr-demo/demo-schema.json diff --git a/.github/workflows/index-review.yml b/.github/workflows/index-review.yml new file mode 100644 index 0000000..94b7f48 --- /dev/null +++ b/.github/workflows/index-review.yml @@ -0,0 +1,35 @@ +name: Index review + +# The repository runs its own GitHub Action on every pull request that touches +# SQL or Mapper XML. Two things are proven by this file existing: the `uses:` ref +# in the README resolves, and a contributor gets advice on the line they changed +# without anyone installing anything. +# +# `fail-on: off` on purpose. Adoption first: the check comments, it does not +# redden the build. A team that wants a gate changes it to `error` in their own +# copy (see examples/github-action/pr-review.yml). + +on: + pull_request: + paths: + - "**/*.xml" + - "**/*.sql" + - "examples/**" + +permissions: + contents: read + pull-requests: write + +jobs: + review: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Index review + uses: JingYu-create520/sql-index-advisor@v0 + with: + path: examples/pr-demo + schema: examples/pr-demo/demo-schema.json + min-severity: info + fail-on: "off" diff --git a/examples/pr-demo/OrderSearchDao.xml b/examples/pr-demo/OrderSearchDao.xml new file mode 100644 index 0000000..292f619 --- /dev/null +++ b/examples/pr-demo/OrderSearchDao.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + diff --git a/examples/pr-demo/demo-schema.json b/examples/pr-demo/demo-schema.json new file mode 100644 index 0000000..0cf48b1 --- /dev/null +++ b/examples/pr-demo/demo-schema.json @@ -0,0 +1,41 @@ +{ + "mysqlVersion": "8.0.46", + "tables": [ + { + "name": "demo_order", + "engine": "InnoDB", + "charset": "utf8mb4", + "rowCountEstimate": 480000, + "columns": [ + { "name": "id", "type": "bigint", "nullable": false }, + { "name": "order_sn", "type": "varchar", "length": 32, "charset": "utf8mb4", "nullable": false }, + { "name": "shop_id", "type": "bigint", "nullable": false }, + { "name": "user_id", "type": "bigint", "nullable": false }, + { "name": "status", "type": "tinyint", "nullable": false }, + { "name": "delete_status", "type": "tinyint", "nullable": false }, + { "name": "receiver_name", "type": "varchar", "length": 64, "charset": "utf8mb4", "nullable": true }, + { "name": "amount", "type": "decimal", "nullable": false }, + { "name": "create_time", "type": "datetime", "nullable": true } + ], + "indexes": [ + { "name": "PRIMARY", "unique": true, "primary": true, "columns": ["id"], "subParts": [null] } + ] + }, + { + "name": "demo_order_detail", + "engine": "InnoDB", + "charset": "utf8mb4", + "rowCountEstimate": 1250000, + "columns": [ + { "name": "id", "type": "bigint", "nullable": false }, + { "name": "order_id", "type": "bigint", "nullable": false }, + { "name": "product_id", "type": "bigint", "nullable": false }, + { "name": "quantity", "type": "int", "nullable": false }, + { "name": "amount", "type": "decimal", "nullable": false } + ], + "indexes": [ + { "name": "PRIMARY", "unique": true, "primary": true, "columns": ["id"], "subParts": [null] } + ] + } + ] +}