From 5dd7fe935b4f2d939593a09d5d1a897b6a46f3d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E5=BF=83=E7=A6=BE=20Wang=2C=20Xinhe?= Date: Thu, 7 Jul 2022 14:30:55 +0800 Subject: [PATCH] ci: build & lint ui only when related files change (#384) --- .github/workflows/build.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6334c251b..6c2a8159f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,7 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive + fetch-depth: 2 - name: Set up Node uses: actions/setup-node@v1 with: @@ -42,10 +43,23 @@ jobs: git config --global user.name undefined git config --global user.email i@undefined.moe yarn + - name: Get specific changed files + id: ui-changed-files + uses: tj-actions/changed-files@v23.1 + with: + files: | + /package.json + .eslint* + packages/ui-default/** + packages/utils/** - name: Build And Lint run: | - yarn build:ui:gulp - parallel --tty -j+0 yarn ::: lint:ci lint:ui:ci build build:ui:production:webpack test + if [[ ${{ steps.ui-changed-files.outputs.any_changed }} == true ]] + then + parallel --tty -j+0 yarn ::: lint:ci lint:ui:ci build build:ui:production test + else + parallel --tty -j+0 yarn ::: lint:ci build test + fi env: PT_PROJECT_TOKEN: ${{ secrets.PT_PROJECT_TOKEN }} - name: Publish