From beef1233fab720a2c83c48d941d3d480c829f7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E7=91=BE?= <74231782+sj817@users.noreply.github.com> Date: Sat, 7 Feb 2026 13:44:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E4=BF=AE=E5=A4=8D=20Update=20apifox?= =?UTF-8?q?=20=E6=AD=A5=E9=AA=A4=E4=B8=AD=E5=9B=A0=20OpenAPI=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=BF=87=E5=A4=A7=E5=AF=BC=E8=87=B4=E7=9A=84=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=88=97=E8=A1=A8=E8=BF=87=E9=95=BF=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e91a160..f227a4dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -458,24 +458,23 @@ jobs: pnpm i pnpm run build:openapi - # 读取并压缩 openapi.json 内容 - OPENAPI_CONTENT=$(cat packages/napcat-schema/dist/openapi.json | tr -d '\n\r\t' | sed 's/ */ /g' | sed 's/"/\\"/g') - - # 构建 JSON 数据 - JSON_DATA=$(printf '{ - "input": "%s", - "options": { + # 使用 jq 安全地构建大型 JSON 数据并保存到文件 + jq -n --rawfile input packages/napcat-schema/dist/openapi.json \ + '{ + input: $input, + options: { "endpointOverwriteBehavior": "OVERWRITE_EXISTING", "schemaOverwriteBehavior": "OVERWRITE_EXISTING", "updateFolderOfChangedEndpoint": true, "moduleId": 1140714, "deleteUnmatchedResources": true } - }' "$OPENAPI_CONTENT") + }' > apifox_payload.json + # 通过文件形式发送数据,避免命令行长度限制 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" + --data-binary @apifox_payload.json