【github action】workflow突然down掉,报错Node.js 16 actions are deprecated. Please update the

文章描述了一位用户在使用GitHubActions时遇到的问题,涉及到Node.js版本升级、Hugo版本不兼容以及actions/checkout等包的更新需求。作者通过调试和尝试不同的解决方案,最终成功解决了问题并处理了警告信息。

github action之前正常运行,现在commit内容的时候,无法运行

一、调试过程

使用actions中的re-run jobs,并启用调试功能,运行faild jobs,然后可以看到如下输出报错内容:

Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20

building中运行的内容出错

Start building sites … 
hugo v0.123.3-a75a659f6fc0cb3a52b2b2ba666a81f79a459376+extended linux/amd64 BuildDate=2024-02-23T17:09:20Z VendorInfo=gohugoio

ERROR render of "section" failed: "/tmp/hugo_cache_runner/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5@v5.8.1-0.20230812165002-59b648791d3f/layouts/_default/baseof.html:11:403": execute of template failed: template: book/list.html:11:403: executing "book/list.html" at <.File.UniqueID>: can't evaluate field File in type *source.File

二、解决办法

根据第二个链接内容提示,猜测actions/checkout@v4这个版本可能有问题,然后将v3修改成v4,重新commit,依然报错。再观察报错内容,发现运行hugo v0.123.3-之后出现错误,猜测可能是hugo版本升级,导致有些内容不匹配。

接着修改hugo的版本:

hugo-version: "latest"
修改为:
hugo-version: '0.119.0'

修改后,重新commit,action正常工作,但是还是会有一个warning

1 warning
hugo-auto-deploy
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v3, peaceiris/actions-hugo@v2, peaceiris/actions-gh-pages@v3. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

查看warning对应内容,可以看到如下说明:

Node 16 has reached its end of life, prompting us to initiate its deprecation process for GitHub Actions. Our plan is to transition all actions to run on Node 20 by Spring 2024. We will actively monitor the migration's progress and gather community feedback before finalizing the transition date. **Starting October 23rd, workflows containing actions running on Node 16 will display a warning to alert users about the upcoming migration.**

说明actions/checkout@v3, peaceiris/actions-hugo@v2, peaceiris/actions-gh-pages@v3.这些版本需要更新和升级了。

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值