Skip to content

ci: upgrade workflow actions to Node24-compatible majors - #309

Merged
ShixiangWang merged 3 commits into
mainfrom
ci/action-upgrades
Oct 9, 2026
Merged

ShixiangWang merged 3 commits into
mainfrom
ci/action-upgrades

Conversation

@ShixiangWang

@ShixiangWang ShixiangWang commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Two CI fixes bundled in one PR (both validated by the same CI runs):

  1. Bump all GitHub Actions to their latest Node24-based majors to
    resolve the "Node.js 20 is deprecated" runner annotations (issue 工程优化专项:站点存储瘦身 × CI 构建提速 × 工作流可扩展性(含实测数据与分阶段方案) #306,
    Phase 0 item C5).
  2. Require the github-pages environment for the deploy-pages job —
    the first deploy-pages run on main (merge of ci: migrate Pages deploy to actions/deploy-pages #308) failed with
    HttpError: Missing environment because actions/deploy-pages requires
    the job to declare environment: name: github-pages. The legacy
    quarto publish gh-pages target never needed one.

1. Action upgrades (version-only)

Action From To
actions/checkout v4 v7
actions/setup-python v5 v7
actions/github-script v7 v9
actions/upload-pages-artifact v3 v5 (wraps upload-artifact v7)
actions/upload-artifact v4 v7
actions/cache (incl. restore/save) v4 v6
julia-actions/setup-julia v2 v3
tj-actions/changed-files v46.0.5 v47.0.6

Already latest (kept): actions/configure-pages@v6, actions/deploy-pages@v5,
quarto-dev/quarto-actions@v2, r-lib/actions@v2. All upgraded majors
verified to declare using: node24.

2. Environment fix (additive, 10 lines)

Both publish workflow jobs get:

environment:
  name: github-pages

The github-pages environment already exists in the repo with a branch
policy allowing main (and legacy gh-pages). This is the documented
requirement of actions/deploy-pages.

Verification

  • All 8 workflow YAML files parse (yaml.safe_load).
  • PR CI runs both publish workflows end-to-end; the merge push will be
    the first fully-correct deploy-pages deploy.

Refs: #306, follow-up to #308

🤖 Generated with Claude Code

Resolve the "Node.js 20 is deprecated" runner annotations by bumping
all GitHub Actions to their latest Node24-based majors:

- actions/checkout v4 -> v7
- actions/setup-python v5 -> v7
- actions/github-script v7 -> v9
- actions/upload-pages-artifact v3 -> v5 (wraps upload-artifact v7)
- actions/upload-artifact v4 -> v7
- actions/cache (incl. restore/save) v4 -> v6
- julia-actions/setup-julia v2 -> v3
- tj-actions/changed-files v46.0.5 -> v47.0.6

actions/configure-pages@v6 and actions/deploy-pages@v5 are already the
latest majors. quarto-dev/quarto-actions@v2 and r-lib/actions@v2 track
their latest majors (v2.2.0 / v2) and are kept.

Version-only change: no step logic, inputs, or permissions modified.
Verified all eight workflow YAML files still parse.

Refs: #306

Co-Authored-By: Claude Code <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

✅ QMD Format Check

No new QMD tutorial files to check.

Automated check by the PR Review workflow.
See contribution guidance for the expected tutorial format.

@ShixiangWang

Copy link
Copy Markdown
Member Author

⚠️ Heads-up before merging this PR: the first deploy-pages run on main (run 37889595653 for merge of #308) failed at Deploy to GitHub Pages with:

HttpError: Missing environment. Ensure your workflow's deployment job has an environment.

Root cause: actions/deploy-pages requires the job to declare environment: name: github-pages (the Pages deployment API rejects requests without it). The legacy quarto publish gh-pages target didn't need this, so the workflows never had it.

Fix in progress: adding the environment block to both publish workflow jobs (follow-up commit to this PR so it's covered by the same CI validation).

The first deploy-pages run on main (merge of #308, run
37889595653) failed at "Deploy to GitHub Pages" with:

  HttpError: Missing environment. Ensure your workflow's
  deployment job has an environment.

actions/deploy-pages requires the deployment job to target the
github-pages environment; the legacy quarto publish gh-pages target
never needed one, so neither workflow declared it. Add
environment.name: github-pages to both build-deploy jobs.

Refs: #306

Co-Authored-By: Claude Code <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

✅ QMD Format Check

No new QMD tutorial files to check.

Automated check by the PR Review workflow.
See contribution guidance for the expected tutorial format.

The github-pages environment protection rules only allow deployments
from main (and legacy gh-pages), so a job targeting the environment
fails on pull_request events (ref refs/pull/<n>/merge) before any
step runs. Split the deploy steps into a separate deploy job with
needs: build-deploy that only runs on push/schedule/dispatch.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

✅ QMD Format Check

No new QMD tutorial files to check.

Automated check by the PR Review workflow.
See contribution guidance for the expected tutorial format.

@ShixiangWang

Copy link
Copy Markdown
Member Author

🔧 修复 PR CI 失败:部署拆分为独立 job

根因确认(来自 annotations):Branch "refs/pull/309/merge" is not allowed to deploy to github-pages due to environment protection rules.

仓库的 github-pages environment 配置了 deployment branch policy,只允许 main 和 gh-pages 部署。pull_request 事件的 ref 是 refs/pull/<n>/merge,在被 protection rules 拦截,job 直接失败(无任何 step 日志)。

修复(c549e0b):将 Configure/Deploy Pages 步骤从 build-deploy 拆分到独立的 deploy job:

  • needs: build-deploy,使用其上传的 github-pages artifact
  • if: github.event_name != 'pull_request' — PR 上只构建+上传 artifact,永不对 environment 发起部署
  • push/schedule/dispatch 时正常部署

这也意味着 PR 不再依赖 environment 检查,CI 可以完全转绿。

🤖 Generated with Claude Code

@ShixiangWang
ShixiangWang merged commit aa561b4 into main Oct 9, 2026
4 checks passed
@ShixiangWang
ShixiangWang deleted the ci/action-upgrades branch October 9, 2026 09:27
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.

1 participant