英文:
Github action workflow schedule is not updating
问题
我有一个计划,计划每隔6分钟运行一次,但实际运行时间是每12分钟左右。我将计划更改为每小时运行,但仍然以旧的频率(大约每12分钟)运行。
为什么会这样?我需要在设置中禁用然后重新启用工作流程以执行计划的更改吗?
工作流程文件:https://github.com/hanniabu/validator_queue_monitoring/blob/main/.github/workflows/update_validator_data.yml
旧计划:
on:
schedule:
- cron: '*/6 * * * *'
新计划:
on:
schedule:
- cron: '* */1 * * *'
英文:
I have a project that's scheduled to run every 6 minutes and works (runs every ~12min). I changed the schedule to run every hour but it's still running at the old cadence (every ~12min).
Why is this? Do I need to disable and re-enable workflow in the settings to execute the change to the schedule?
workflow file: https://github.com/hanniabu/validator_queue_monitoring/blob/main/.github/workflows/update_validator_data.yml
old schedule:
on:
schedule:
- cron: '*/6 * * * *'
new schedule:
on:
schedule:
- cron: '* */1 * * *'
答案1
得分: 2
我不认为你的新cron表达式是正确的。
你可以使用像 crontab 这样的方便工具来检查cron表达式是否正确。
对于你的cron表达式:* */1 * * *
,它基本上每小时运行一次,每分钟都运行(本质上是每分钟)。
此外,根据GitHub actions的 文档:
> 你可以运行调度工作流的最短间隔是每5分钟一次。
所以,你基本上在告诉GitHub actions每分钟运行你的工作流,因此它会尝试每5分钟运行一次。
考虑到GitHub actions的工作负载,它实际上每12分钟运行一次。
如果你想每小时运行一次你的工作流,请使用这个cron表达式:0 * * * *
。
英文:
I don't think your new cron is correct.
You can use handy tool like crontab to check if the cron is correct or not.
For your cron: * */1 * * *
it basically runs each hour and for every minute (essentially every minute)
Also From the GitHub actions documentation:
> The shortest interval you can run scheduled workflows is once every 5
> minutes.
So you are essentially saying github actions to run your workflow every minute, hence it tries to run it every 5 minutes instead.
Adding in the workload on GitHub actions, it is running for every 12 minutes practically.
If you want to run your workflow every hour then use this cron: 0 * * * *
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论