道招

Github actions如何让某个step自动重试

如果您发现本文排版有问题,可以先点击下面的链接切换至老版进行查看!!!

Github actions如何让某个step自动重试

最近有个github action项目中的某个步骤step需要执行下载文件,但是近期开始出现下载超时的情况,并且还有点频繁。自己除了找服务器的原因以外,还想通过优化github actions来尽量避免下载超时的问题。

在网上搜了下,github actions官方没有这样的功能,但是好在第三方的actions里面有,那就省事多了。

有个叫nick-fields/retry@v3的,我们可以直接利用它来实现重试功能,参数配置也很简单。

截取里面几个有用的配置

Inputs:

timeout_minutes Required Minutes to wait before attempt times out. Must only specify either minutes or seconds

timeout_seconds Required Seconds to wait before attempt times out. Must only specify either minutes or seconds

max_attempts Required Number of attempts to make before failing the step

用法如下:

name: Run script
uses: nick-fields/retry@v3
with:
  timeout_minutes: 10
  timeout_seconds: 120
  max_attempts: 3
  command: npm run some-typically-slow-script

除了能配置Inputs外还能配置Outputs呢

Outputs

total_attempts The final number of attempts made

exit_code The final exit code returned by the command

exit_error The final error returned by the command

更新时间:
上一篇:Charles抓取https请求unknown?赶紧换Proxyman吧下一篇:利用nodejs whistle实现HarmonyOS NEXT微信38版本

相关文章

通过github actions将佳明数据同步高驰平台脚本(支持国际区与国区)

最近发现了一个能将佳明数据同步高驰平台github脚本(支持国际区与国区) github地址 https://github.com/XiaoSiHwang/garmin-sync-coros 阅读更多…

githubaction提示The `set-output` command is deprecated and will be disabled soon怎么解决

这是github官方的改动,github actions不再推荐使用过时的写法 过时的写法 - name: Save state run: echo "::save-st 阅读更多…

github actions/checkout@v4 清空当前文件(Deleting the contents of xxx)怎么办

我们在使用github actions时几乎都会用到actions/checkout@v4,它的主要目的是把我们github项目的源代码给拉下来,它在拉代码之前会先把目标文件夹给清空了,但是有时我们 阅读更多…

通过github actions实现佳明数据与高驰运动记录双向同步

之前分享过一个 《通过github actions将佳明数据同步高驰平台脚本(支持国际区与国区)》 ,fork了里面的github项目,经过测试后发现确实可以将佳明的运动记录定时同步到高驰呢,可是不 阅读更多…

关注道招网公众帐号
友情链接
消息推送
道招网关注互联网,分享IT资讯,前沿科技、编程技术,是否允许文章更新后推送通知消息。
允许
不用了