From 4939a9c33d0f0f1fbe8dee9d19c09ea6e5eb0b96 Mon Sep 17 00:00:00 2001 From: Yunlu Wen Date: Fri, 29 May 2026 17:26:32 +0800 Subject: [PATCH] refactor: add ts common style check for web and cli (#36823) --- .github/workflows/style.yml | 63 +++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index c40ca5c1ea..e18607a60e 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -95,6 +95,51 @@ jobs: if: steps.changed-files.outputs.any_changed == 'true' uses: ./.github/actions/setup-web + - name: Web tsslint + if: steps.changed-files.outputs.any_changed == 'true' + env: + NODE_OPTIONS: --max-old-space-size=4096 + run: vp run lint:tss + + - name: Web dead code check + if: steps.changed-files.outputs.any_changed == 'true' + run: vp run knip + + ts-common-style: + name: TS Common + runs-on: depot-ubuntu-24.04 + permissions: + checks: write + pull-requests: read + + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Check changed files + id: changed-files + uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 + with: + files: | + web/** + cli/** + e2e/** + sdks/nodejs-client/** + packages/** + package.json + pnpm-lock.yaml + pnpm-workspace.yaml + .nvmrc + eslint.config.mjs + .github/workflows/style.yml + .github/actions/setup-web/** + + - name: Setup web environment + if: steps.changed-files.outputs.any_changed == 'true' + uses: ./.github/actions/setup-web + - name: Restore ESLint cache if: steps.changed-files.outputs.any_changed == 'true' id: eslint-cache-restore @@ -105,28 +150,14 @@ jobs: restore-keys: | ${{ runner.os }}-eslint-${{ hashFiles('pnpm-lock.yaml', 'eslint.config.mjs', 'web/eslint.config.mjs', 'web/eslint.constants.mjs', 'web/plugins/eslint/**') }}- - - name: Web style check + - name: Style check if: steps.changed-files.outputs.any_changed == 'true' - working-directory: . run: vp run lint:ci - - name: Web tsslint + - name: Type check if: steps.changed-files.outputs.any_changed == 'true' - working-directory: ./web - env: - NODE_OPTIONS: --max-old-space-size=4096 - run: vp run lint:tss - - - name: Web type check - if: steps.changed-files.outputs.any_changed == 'true' - working-directory: . run: vp run type-check - - name: Web dead code check - if: steps.changed-files.outputs.any_changed == 'true' - working-directory: ./web - run: vp run knip - - name: Save ESLint cache if: steps.changed-files.outputs.any_changed == 'true' && success() && steps.eslint-cache-restore.outputs.cache-hit != 'true' uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5