From 94de5560c66148a11725979df7beed0ed66d8ab7 Mon Sep 17 00:00:00 2001 From: maigamo <13341529504@163.com> Date: Mon, 23 Jun 2025 16:14:14 +0800 Subject: [PATCH 1/3] Update main.yml --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a6a1f0e..b36dd70 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,7 +34,6 @@ jobs: - name: Check output files run: | - test -f main.js || (echo "❌ main.js not found after build" && exit 1) test -f manifest.json || (echo "❌ manifest.json not found" && exit 1) - name: Enforce commit message format (push only) From 32df0e1ddfe3b78debd8d725827d0e841ef2b47f Mon Sep 17 00:00:00 2001 From: maigamo <13341529504@163.com> Date: Mon, 23 Jun 2025 16:23:03 +0800 Subject: [PATCH 2/3] fix:update workflows --- .github/workflows/main.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b36dd70..2f35142 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,16 +24,27 @@ jobs: - name: Install dependencies run: npm ci + - name: Check for forbidden console logs + run: | + if grep -rE 'console\.log|console\.warn|console\.error' src/; then + echo "❌ 代码中包含 console.log/warn/error,禁止提交" + exit 1 + fi + - name: Type Check (non-strict) run: | echo "Running TypeScript check..." npx tsc --noEmit || echo "⚠️ TypeScript check failed, but continuing." - name: Build plugin - run: node esbuild.config.mjs production + run: npm run build + + - name: List files after build + run: ls -lah - name: Check output files run: | + test -f main.js || (echo "❌ main.js not found after build" && exit 1) test -f manifest.json || (echo "❌ manifest.json not found" && exit 1) - name: Enforce commit message format (push only) From 627736219092ec2328fe9e77634056018bee2d53 Mon Sep 17 00:00:00 2001 From: maigamo <13341529504@163.com> Date: Mon, 23 Jun 2025 16:25:43 +0800 Subject: [PATCH 3/3] fix:update workflows --- .github/workflows/main.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2f35142..ca009b4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,18 +12,22 @@ jobs: runs-on: ubuntu-latest steps: + # 拉取代码 - name: Checkout code uses: actions/checkout@v4 + # 设置 Node.js 环境 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' + # 安装依赖 - name: Install dependencies run: npm ci + # 检查代码是否包含禁止的 console.log/warn/error - name: Check for forbidden console logs run: | if grep -rE 'console\.log|console\.warn|console\.error' src/; then @@ -31,22 +35,34 @@ jobs: exit 1 fi + # TypeScript 类型检查(失败不阻断) - name: Type Check (non-strict) run: | echo "Running TypeScript check..." npx tsc --noEmit || echo "⚠️ TypeScript check failed, but continuing." + # 构建插件(使用 package.json 中的 build 脚本) - name: Build plugin run: npm run build + # 列出当前目录,方便调试 - name: List files after build run: ls -lah + # 检查构建产物是否存在 - name: Check output files run: | - test -f main.js || (echo "❌ main.js not found after build" && exit 1) - test -f manifest.json || (echo "❌ manifest.json not found" && exit 1) + echo "当前工作目录:$(pwd)" + if [ ! -f main.js ]; then + echo "❌ main.js not found after build" + exit 1 + fi + if [ ! -f manifest.json ]; then + echo "❌ manifest.json not found" + exit 1 + fi + # 仅在 push 事件时校验提交信息格式 - name: Enforce commit message format (push only) if: github.event_name == 'push' run: |