From 2b94e36df6addbe0f504f85c6d97150f12eda88d Mon Sep 17 00:00:00 2001
From: Alex Yang <himself65@outlook.com>
Date: Thu, 30 Nov 2023 19:38:42 -0600
Subject: [PATCH] ci: update workflow version (#239)

---
 .github/workflows/lint_on_push_or_pull.yml | 14 +++++++-------
 .github/workflows/test.yml                 | 16 ++++++----------
 .nvmrc                                     |  1 +
 3 files changed, 14 insertions(+), 17 deletions(-)
 create mode 100644 .nvmrc

diff --git a/.github/workflows/lint_on_push_or_pull.yml b/.github/workflows/lint_on_push_or_pull.yml
index 67e316882..576725646 100644
--- a/.github/workflows/lint_on_push_or_pull.yml
+++ b/.github/workflows/lint_on_push_or_pull.yml
@@ -12,14 +12,14 @@ jobs:
   lint:
     runs-on: ubuntu-latest
     steps:
-      - name: Checkout code
-        uses: actions/checkout@v2
-
-      - name: Install pnpm
-        run: npm install -g pnpm
-
+      - uses: actions/checkout@v4
+      - uses: pnpm/action-setup@v2
+      - name: Setup Node.js
+        uses: actions/setup-node@v4
+        with:
+          node-version-file: '.nvmrc'
+          cache: "pnpm"
       - name: Install dependencies
         run: pnpm install
-
       - name: Run lint
         run: pnpm run lint
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 868670f15..4436b6357 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -7,18 +7,14 @@ jobs:
     runs-on: ubuntu-latest
 
     steps:
-      - name: Checkout code
-        uses: actions/checkout@v2
-
+      - uses: actions/checkout@v4
+      - uses: pnpm/action-setup@v2
       - name: Setup Node.js
-        uses: actions/setup-node@v2
+        uses: actions/setup-node@v4
         with:
-          node-version: "18"
-
+          node-version-file: '.nvmrc'
+          cache: "pnpm"
       - name: Install dependencies
-        run: |
-          npm i -g pnpm
-          pnpm install
-
+        run: pnpm install
       - name: Run tests
         run: pnpm run test
diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 000000000..3c032078a
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+18
-- 
GitLab