[英]Github actions, schedule operation on branch
I am trying to configure a github workflow, I have managed to configure it on push event.我正在尝试配置 github 工作流程,我已设法在推送事件中对其进行配置。 However what if I need it to run on after a time period has passed?但是,如果我需要它在一段时间后继续运行怎么办?
What I have understood from the documentation is that it can be achieved using a schedule.我从文档中了解到的是,它可以使用时间表来实现。
name: Release Management
on:
schedule:
- cron: "*/5 * * * *"
How do I specify the branch that the action will run on?如何指定操作将在哪个分支上运行?
My end goal is to automate releases.我的最终目标是自动化发布。
If you take a look at the documentation here you will see that the GITHUB_SHA
associated with the on: schedule
event is "Last commit on default branch."如果您查看此处的文档,您将看到与on: schedule
事件关联的GITHUB_SHA
是“Last commit on default branch”。 This is what will be checked out by default when you use the actions/checkout
action.这是您使用actions/checkout
操作时默认签出的内容。
If your repository's default branch is master
(which in general is the case) this workflow will checkout the last commit on master
when it triggers.如果您的存储库的默认分支是master
(通常是这种情况),则此工作流将在触发时检查master
上的最后一次提交。
name: Release Management
on:
schedule:
- cron: "*/5 * * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
If you want to checkout a different branch you can specify with parameters on the checkout action.如果你想签出一个不同的分支,你可以在 checkout 操作中指定参数。 This workflow will checkout the last commit on the some-branch
branch.此工作流程将检查some-branch
分支上的最后一次提交。
name: Release Management
on:
schedule:
- cron: "*/5 * * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: some-branch
See documentation for the actions/checkout
action for other options.有关其他选项的actions/checkout
操作,请参阅文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.