gpt4 book ai didi

github - 如何在特定分支上触发计划操作?

转载 作者:行者123 更新时间:2023-12-04 08:59:52 26 4
gpt4 key购买 nike

我采取了行动。我希望它在分支 foo 上运行按计划(在我的情况下,每天两次)。
这是我到目前为止所得到的:repo/.github/workflows/daily-foo-tests.yml

name: Run integration tests on foo branch twice a day
on:
schedule:
# Execute at 00:01 and 13:01 UTC daily
- cron: '00 01,13 * * *'

jobs:
build:
name: Run UI Automation
runs-on: [self-hosted, macOS, X64]
steps:
- uses: actions/checkout@v2
- name: dotnet build
with: { ref: foo }
// continues to do stuff, not important
现在,此操作已推送至 foo分支。但是,要去 github.com/org/repo/actions ,它不会触发(我现在已经等了 24 小时;此时它应该已经做了一些事情)。
在指定分支上触发预定的 github 操作工作流的正确方法是什么?

最佳答案

工作流必须提交到要触发的默认分支。如果您仅将其提交到非默认分支,它将不起作用。

Scheduled workflows run on the latest commit on the default or base branch.


引用: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule
例如,这应该提交到默认分支。当它运行时,它会 check out 分支 foo然后你可以构建,测试等。
on:
schedule:
- cron: '0 1 * * 4'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: foo

# Build steps go here

关于github - 如何在特定分支上触发计划操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63612155/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com