【问题标题】:Github actions, schedule operation on branchGithub 操作,在分支上调度操作
【发布时间】:2020-03-06 23:52:06
【问题描述】:

我正在尝试配置一个 github 工作流,我已经设法在推送事件上配置它。但是,如果我需要它在一段时间后继续运行呢?

我从documentation了解到的是,可以使用时间表来实现。

name: Release Management

on: 
  schedule:
   - cron: "*/5 * * * *"

如何指定操作将在哪个分支上运行?

我的最终目标是自动化发布。

【问题讨论】:

    标签: git github workflow github-actions


    【解决方案1】:

    如果您查看documentation here,您将看到与on: schedule 事件关联的GITHUB_SHA 是“默认分支上的最后一次提交”。这是您使用actions/checkout 操作时默认检查的内容。

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

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

    如果您想签出不同的分支,您可以在 checkout 操作中指定参数。此工作流将检查 some-branch 分支上的最后一次提交。

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

    有关其他选项,请参阅documentation for the actions/checkout 操作。

    【讨论】:

      猜你喜欢
      • 2021-06-04
      • 1970-01-01
      • 2021-02-23
      • 2020-06-03
      • 1970-01-01
      • 2022-08-15
      • 2020-06-25
      • 2020-01-30
      • 2020-03-10
      相关资源
      最近更新 更多