From 58d5725b7a5306c6c6a4c24d0bdb3ad5062f57c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=8F=9C=20Cai?= Date: Wed, 23 Oct 2024 09:32:29 +0800 Subject: [PATCH] ci: some ci only after certain file directories are changed (#951) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci: some ci only after certain file directories are changed * 修改限制目录匹配规则 添加测试脚本action限制 * 测试action 过滤目录添加test目录 --- .github/workflows/build.yml | 5 +++++ .github/workflows/pr-merge-dev-npm_preview.yml | 5 +++++ .github/workflows/pr-merge.yml | 5 +++++ .github/workflows/pr-test.yml | 12 +++++++++--- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5030c607a..f25439061 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,11 @@ on: branches: [main, dev] pull_request: branches: [main, dev] + paths: # 这里是用来指定哪个文件更改,才会触发的 + - 'src/**' + - 'package.json' + - 'types/**' + - 'examples/**' jobs: build: diff --git a/.github/workflows/pr-merge-dev-npm_preview.yml b/.github/workflows/pr-merge-dev-npm_preview.yml index 7d6445305..d2593cbc1 100644 --- a/.github/workflows/pr-merge-dev-npm_preview.yml +++ b/.github/workflows/pr-merge-dev-npm_preview.yml @@ -14,6 +14,11 @@ on: pull_request_target: types: - closed + paths: # 这里是用来指定哪个文件更改,才会触发的 + - 'src/**' + - 'package.json' + - 'types/**' + - 'examples/**' permissions: pull-requests: write diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index bd6bd8828..d19bb5b43 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -4,6 +4,11 @@ on: pull_request_target: types: - closed + paths: # 这里是用来指定哪个文件更改,才会触发的 + - 'src/**' + - 'package.json' + - 'types/**' + - 'examples/**' jobs: remove_assets: diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index e3a4e35d8..d17d959f5 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -3,6 +3,12 @@ name: PR Test on: pull_request_target: branches: [main, dev] + paths: # 这里是用来指定哪个文件更改,才会触发的 + - "src/**" + - "package.json" + - "types/**" + - "examples/**" + - "test/**" jobs: build: @@ -16,7 +22,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - ref: '${{ env.HEAD_SHA }}' + ref: "${{ env.HEAD_SHA }}" - name: Get changed files and operations run: | @@ -39,7 +45,7 @@ jobs: if: ${{ env.GIT_DIFF_FILES }} with: repository: ${{ github.repository }} - ref: '${{ env.BASE_SHA }}' + ref: "${{ env.BASE_SHA }}" path: base-repo - name: Replace changed files @@ -54,7 +60,7 @@ jobs: uses: actions/setup-node@v2 with: node-version: 16.x - cache: 'yarn' + cache: "yarn" - name: Install dependencies uses: borales/actions-yarn@v3.0.0