Skip to content

Fix build failure: upgrade Node 8.x → 20.x for macOS arm64 compatibility and add PR trigger#24

Merged
hustcc merged 4 commits into
masterfrom
copilot/fix-github-actions-build-failure
Jan 24, 2026
Merged

Fix build failure: upgrade Node 8.x → 20.x for macOS arm64 compatibility and add PR trigger#24
hustcc merged 4 commits into
masterfrom
copilot/fix-github-actions-build-failure

Conversation

Copilot AI commented Jan 24, 2026

Copy link
Copy Markdown
Contributor

GitHub Actions failing on macOS arm64 runners: Unable to find Node version '8.x' for platform darwin and architecture arm64.

Changes

  • Node version: [8.x, 10.x, 12.x][20.x]

    • Node 8.x unavailable on macOS arm64
    • Node 20.x is current LTS (supported until 2026-04-30)
  • Action versions: v1v4

    • actions/checkout@v4
    • actions/setup-node@v4
  • CI trigger: Added pull_request trigger

    • CI now runs on pull requests targeting master/main branches
+on:
+  push:
+    branches: [ master, main ]
+  pull_request:
+    branches: [ master, main ]

strategy:
  matrix:
-   node-version: [8.x, 10.x, 12.x]
+   node-version: [20.x]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Original prompt

在仓库 hustcc/size-sensor 中修复 GitHub Actions 构建失败。

背景:Actions 运行 https://github.com/hustcc/size-sensor/actions/runs/21053511606/job/60544708406 失败,日志报错:

  • Unable to find Node version '8.x' for platform darwin and architecture arm64.

原因:workflow .github/workflows/build.yml 使用 actions/setup-node 并指定 node-version: 8.x,在 macOS arm64 runner 上无法找到 Node 8。

需要的改动:

  1. 更新 .github/workflows/build.ymlactions/setup-node 步骤:将 Node 版本从 8.x 升级到 20
  2. 建议同时将 actions/setup-node action 版本更新为 v4(若当前不是 v4)。
  3. 确保 workflow 在默认 runner 上可以正常运行(至少修复上述报错)。

验收标准:

  • workflow build 在 GitHub Actions 上不再因 Node 版本安装失败而报错。
  • 相关 YAML 变更清晰、最小化,并附带说明升级原因。

参考:失败的 ref 为 b9be27ef358a32546110c011bc2fa587e23ec62e;代码链接请使用该 ref。

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…pdate actions to v4

Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix GitHub Actions build failure due to Node version Fix build failure: upgrade Node 8.x → 20.x for macOS arm64 compatibility Jan 24, 2026
Copilot AI requested a review from hustcc January 24, 2026 12:10
@hustcc hustcc marked this pull request as ready for review January 24, 2026 12:10
@hustcc

hustcc commented Jan 24, 2026

Copy link
Copy Markdown
Owner

@copilot github action 配置加上 pull request 的时候,也执行 ci。

另外再看看 action 配置文件有没有可以优化的地方。

Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>

Copilot AI commented Jan 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot github action 配置加上 pull request 的时候,也执行 ci。

另外再看看 action 配置文件有没有可以优化的地方。

已完成修改 (ff02219):

  1. ✅ 添加了 pull_request 触发器,现在 CI 会在 PR 时执行
  2. ✅ 优化了工作流配置:
    • 添加 npm 缓存 (cache: 'npm') 加速构建
    • 指定目标分支 (master, main) 使触发条件更明确
    • 改进格式和空行以提高可读性

Copilot AI changed the title Fix build failure: upgrade Node 8.x → 20.x for macOS arm64 compatibility Fix build failure: upgrade Node 8.x → 20.x for macOS arm64 compatibility and optimize workflow Jan 24, 2026
@hustcc

hustcc commented Jan 24, 2026

Copy link
Copy Markdown
Owner

@copilot 去掉第二项中 cache 的优化。

Co-authored-by: hustcc <7856674+hustcc@users.noreply.github.com>

Copilot AI commented Jan 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot 去掉第二项中 cache 的优化。

已移除 npm cache 配置 (d5f1b12)

Copilot AI changed the title Fix build failure: upgrade Node 8.x → 20.x for macOS arm64 compatibility and optimize workflow Fix build failure: upgrade Node 8.x → 20.x for macOS arm64 compatibility and add PR trigger Jan 24, 2026
@hustcc hustcc merged commit 9514256 into master Jan 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants