【发布时间】:2021-07-17 08:40:01
【问题描述】:
基于documentation(还有一个SO answer),我写了这个:
on:
push
concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers.
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
...
这会为每个分支创建一个单独的组,并在稍后推送/强制推送到分支时取消构建。
可悲的是,这也取消了我不想要的master 构建。在master 上,所有提交都应该完成运行,因此很容易看出什么时候发生了故障。
我本质上是在寻找一种表达方式:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
if: github.ref != 'refs/heads/master'
【问题讨论】:
-
"A concurrency group can be any string or expression" - 所以也许在 master 上,该组是提交哈希,即没有任何东西被分组,而在 master 上它是分支?
-
????♂️,是的!谢谢!可能是早上太早了。
-
这很有趣,@jonrsharpe,这里没有三元...无论如何我找到了解决方法来获得“如果”,让我试试。
标签: github-actions