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

被折叠的 条评论
为什么被折叠?



