【问题标题】:Only run GitHub actions if pr target is master仅当 pr 目标为 master 时才运行 GitHub 操作
【发布时间】:2019-09-17 06:49:29
【问题描述】:

我试图找出一种方法,仅当 pr 打开到 master 时才运行 GitHub 工作流,即更改正在进入 master。

到此为止

workflow "Install Yarn Dependencies" {
  on = "pull_request"
  resolves = ["Install"]
}

action "Is Master Branch" {
  uses = "actions/bin/filter@master"
  args = "branch master"
}

action "Install" {
  needs = "Is Master Branch"
  uses = "nuxt/actions-yarn@master"
  args = "install"
}

当我打开合并development 分支到master 分支的拉取请求时,我的Install 操作没有运行,因为Is Master Branch 返回

refs/heads/development 与 refs/heads/master 不匹配

【问题讨论】:

    标签: github github-actions


    【解决方案1】:

    使用新的YAML 语法,您可以这样实现:

    on:
      pull_request:
        branches:
        - master
    

    【讨论】:

      【解决方案2】:

      ref 代替branch 怎么样? (虽然我还没有测试过这段代码)

      action "Is Master Branch" {
        uses = "actions/bin/filter@master"
        args = "ref refs/heads/master"
      }
      

      【讨论】:

        猜你喜欢
        • 2019-09-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-08-11
        • 2017-12-22
        • 1970-01-01
        • 1970-01-01
        • 2014-08-20
        相关资源
        最近更新 更多