From 6ebdc83104cc6df547ac19fa1a6c4a2ab8c135f9 Mon Sep 17 00:00:00 2001 From: lanyeeee Date: Sun, 1 Mar 2026 05:50:15 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E8=87=AA=E5=8A=A8=E6=A3=80=E6=9F=A5pr?= =?UTF-8?q?=E7=9A=84=E5=89=8D=E7=AB=AF=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check-frontend.yml | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/check-frontend.yml diff --git a/.github/workflows/check-frontend.yml b/.github/workflows/check-frontend.yml new file mode 100644 index 0000000..77b190a --- /dev/null +++ b/.github/workflows/check-frontend.yml @@ -0,0 +1,66 @@ +name: Check Frontend + +on: + pull_request: + +jobs: + frontend-check: + runs-on: ubuntu-24.04 + + permissions: + contents: read + pull-requests: read + + steps: + - name: Check frontend changes + id: changes + uses: dorny/paths-filter@v3 + with: + filters: | + frontend: + - 'src/**' + - 'index.html' + - 'vite.config.*' + - 'eslint.config.*' + - '.prettierrc*' + - '.prettierignore' + - 'tsconfig*.json' + - 'package.json' + - 'pnpm-lock.yaml' + - '.github/workflows/check-frontend.yml' + + - name: Skip frontend checks when unchanged + if: steps.changes.outputs.frontend != 'true' + run: echo "No frontend changes detected, skipping frontend checks." + + - name: Checkout code + if: steps.changes.outputs.frontend == 'true' + uses: actions/checkout@v4 + + - name: Setup Node.js + if: steps.changes.outputs.frontend == 'true' + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Setup pnpm + if: steps.changes.outputs.frontend == 'true' + uses: pnpm/action-setup@v4 + with: + run_install: false + + - name: Install dependencies + if: steps.changes.outputs.frontend == 'true' + run: pnpm install + + - name: Run Prettier check + if: steps.changes.outputs.frontend == 'true' + run: pnpm exec prettier . --check + + - name: Run ESLint check + if: steps.changes.outputs.frontend == 'true' + run: pnpm exec eslint -c eslint.config.js --max-warnings=0 src + + - name: Run Vue TSC check + if: steps.changes.outputs.frontend == 'true' + run: pnpm exec vue-tsc --noEmit