4

我试图找出一种仅在将 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 不匹配

4

2 回答 2

4

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

on:
  pull_request:
    branches:
    - master
于 2019-08-22T15:11:16.793 回答
2

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

action "Is Master Branch" {
  uses = "actions/bin/filter@master"
  args = "ref refs/heads/master"
}
于 2019-04-29T04:51:31.610 回答