我做了一个动作。我希望它按时间表(在我的情况下,每天两次(在分支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操作工作流的正确方法是什么?
工作流必须提交到要触发的默认分支。如果您只将它提交给非默认分支,它将不起作用。
计划的工作流在默认分支或基本分支的最新提交时运行。
ref:https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule
例如,这应该提交到默认分支。当它运行时,它检查出分支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