From 2a7a660cc4fdb631baef3e19ac1c2362829e2181 Mon Sep 17 00:00:00 2001 From: mini2024 Date: Fri, 4 Apr 2025 21:25:36 +0800 Subject: [PATCH] setup-node-environment-test.yaml --- .../setup-node-environment-test.yaml | 23 ++++++++----------- setup-node-environment/action.yml | 16 ++++++------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.github/workflows/setup-node-environment-test.yaml b/.github/workflows/setup-node-environment-test.yaml index 06ecdc1..82715d4 100644 --- a/.github/workflows/setup-node-environment-test.yaml +++ b/.github/workflows/setup-node-environment-test.yaml @@ -56,15 +56,12 @@ jobs: strategy: fail-fast: false matrix: - checkout: - - true - - false container: - 'yanhao98/runner-images:pnpm' - '' # gitea/runner-images:ubuntu-latest npmrc_content: - '' - - | + - | use-node-version=22.14.0 # https://pnpm.io/zh/npmrc#use-node-version lock_file: - 'true' @@ -74,13 +71,11 @@ jobs: - 'test' container: ${{ matrix.container }} steps: - - uses: actions/checkout@main - if: matrix.checkout == 'true' + # - uses: actions/checkout@main - name: 打印 matrix run: | echo "🤖---- 打印 matrix ----🤖" echo "container: ${{ matrix.container }}" - echo "checkout: ${{ matrix.checkout }}" echo "npmrc_content: ${{ matrix.npmrc_content }}" echo "lock_file: ${{ matrix.lock_file }}" echo "cwd: ${{ matrix.cwd }}" @@ -90,18 +85,21 @@ jobs: if: matrix.cwd != '' run: | mkdir -p ${{ matrix.cwd }} + set -x; + ls -l -R . pwd - name: Create .npmrc working-directory: ${{ matrix.cwd }} if: matrix.npmrc_content != '' run: | - set -x; - ls -l -R . cat < .npmrc ${{ matrix.npmrc_content }} EOF + set -x; + ls -l -R . pwd + cat .npmrc - name: Create package.json working-directory: ${{ matrix.cwd }} @@ -112,22 +110,21 @@ jobs: EOF set -x; ls -l -R . - cat package.json pwd + cat package.json - name: Create pnpm-lock.yaml working-directory: ${{ matrix.cwd }} if: matrix.lock_file == 'true' run: | - mkdir -p ${{ github.workspace }}/.git cat < pnpm-lock.yaml ${{ needs.generate_lock.outputs.lock_file_content }} EOF set -x; ls -l -R . + pwd cat pnpm-lock.yaml - uses: yanhao98/composite-actions/setup-node-environment@main with: - package_json_cwd: ${{ matrix.cwd }} - # pnpm_standalone: true \ No newline at end of file + working-directory: ${{ matrix.cwd }} diff --git a/setup-node-environment/action.yml b/setup-node-environment/action.yml index b6f519b..19bcbd1 100644 --- a/setup-node-environment/action.yml +++ b/setup-node-environment/action.yml @@ -18,8 +18,9 @@ inputs: description: '是否将 pnpm 用作独立包' required: false default: 'false' - package_json_cwd: # https://github.com/pnpm/action-setup/blob/d648c2dd069001a242c621c8306af467f150e99d/action.yml#L18C3-L18C20 - description: 'package.json 的所在目录' + # https://github.com/pnpm/action-setup/blob/d648c2dd069001a242c621c8306af467f150e99d/action.yml#L18C3-L18C20 + working-directory: + description: '工作目录' required: false default: '.' runs: @@ -40,7 +41,7 @@ runs: - id: prepare shell: bash - working-directory: ${{ inputs.package_json_cwd }} + working-directory: ${{ inputs.working-directory }} run: | # 🤖---- 准备环境变量 ----🤖 # @@ -185,7 +186,7 @@ runs: shell: bash - if: steps.cache-pnpm-restore.outputs.cache-hit == 'true' - working-directory: ${{ inputs.package_json_cwd }} + working-directory: ${{ inputs.working-directory }} shell: bash run: | echo "🤖---- 缓存命中,安装依赖 ----🤖" @@ -194,7 +195,7 @@ runs: # ERR_PNPM_NO_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent - if: steps.cache-pnpm-restore.outputs.cache-hit != 'true' - working-directory: ${{ inputs.package_json_cwd }} + working-directory: ${{ inputs.working-directory }} shell: bash run: | echo "🤖---- 缓存未命中,安装依赖 ----🤖" @@ -211,7 +212,6 @@ runs: with: path: ${{ steps.pnpm-store-dir.outputs.pnpmStoreDir }} key: ${{ steps.cache-pnpm-restore.outputs.cache-primary-key }} - # # https://github.com/pnpm/pnpm/issues/7192#issuecomment-2353298966 # package-import-method=hardlink @@ -219,6 +219,6 @@ runs: # pnpm fetch # pnpm install --offline # pnpm store prune -# # +# # # rm -r node_modules -# pnpm install --offline \ No newline at end of file +# pnpm install --offline