From dc8b85da1cc60eb07f7cf49f61b3bffa03ae3737 Mon Sep 17 00:00:00 2001 From: pohgxz Date: Thu, 5 Feb 2026 12:56:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0api?= =?UTF-8?q?fox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 31 +++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 32 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 726e51a2..ddb4566d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -486,3 +486,34 @@ jobs: NapCat.Shell.zip NapCat.Shell.Windows.OneKey.zip draft: true + + + - name: Update apifox + env: + APIFOX_TOKEN: ${{ secrets.APIFOX_TOKEN }} + run: | + npm i -g pnpm + pnpm i + pnpm run build:openapi + + # 读取并压缩 openapi.json 内容 + OPENAPI_CONTENT=$(cat packages/napcat-schema/openapi.json | tr -d '\n\r\t' | sed 's/ */ /g' | sed 's/"/\\"/g') + + # 构建 JSON 数据 + JSON_DATA=$(printf '{ + "input": "%s", + "options": { + "endpointOverwriteBehavior": "OVERWRITE_EXISTING", + "schemaOverwriteBehavior": "OVERWRITE_EXISTING", + "updateFolderOfChangedEndpoint": true, + "moduleId": 1140714, + "deleteUnmatchedResources": true + } + }' "$OPENAPI_CONTENT") + + curl --location -g --request POST 'https://api.apifox.com/v1/projects/5348325/import-openapi?locale=zh-CN' \ + --header 'X-Apifox-Api-Version: 2024-03-28' \ + --header 'Authorization: Bearer $APIFOX_TOKEN' \ + --header 'Content-Type: application/json' \ + --data-raw "$JSON_DATA" + diff --git a/package.json b/package.json index 17febcd8..4ea35cad 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "build:framework": "pnpm --filter napcat-framework run build || exit 1", "build:webui": "pnpm --filter napcat-webui-frontend run build || exit 1", "build:plugin-builtin": "pnpm --filter napcat-plugin-builtin run build || exit 1", + "build:openapi": "pnpm --filter napcat-schema run build:openapi || exit 1", "dev:shell": "pnpm --filter napcat-develop run dev || exit 1", "typecheck": "pnpm -r --if-present run typecheck", "test": "pnpm --filter napcat-test run test",