Github操作,计划分支上的操作 [英] Github actions, schedule operation on branch

查看:83
本文介绍了Github操作,计划分支上的操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试配置github工作流程,我已经设法在push事件上对其进行了配置.但是,如果我需要一段时间后才能继续运行该怎么办?

I am trying to configure a github workflow, I have managed to configure it on push event. 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.

推荐答案

如果您查看actions/checkout操作时,默认情况下将对此进行检出.

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." This is what will be checked out by default when you use the actions/checkout action.

如果存储库的默认分支为master(通常是这种情况),则此工作流将在触发时签出master上的最后一次提交.

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.

name: Release Management
on: 
  schedule:
   - cron: "*/5 * * * *"
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1

如果要签出其他分支,则可以在签出操作中使用参数指定.此工作流程将检出some-branch分支上的最后一次提交.

If you want to checkout a different branch you can specify with parameters on the checkout action. This workflow will checkout the last commit on the some-branch branch.

name: Release Management
on: 
  schedule:
   - cron: "*/5 * * * *"
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
        with:
          ref: some-branch

有关其他选项,请参见actions/checkout 操作的文档.

See documentation for the actions/checkout action for other options.

这篇关于Github操作,计划分支上的操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆