有没有什么聪明的方法来确定 Github 操作中的默认分支?
现在我需要写一些类似的东西:
on:
push:
branches:
- master
有没有办法编写类似下面的代码?on:
push:
branches:
- $default-branch
我试着用谷歌搜索但什么也没找到
最佳答案
这目前是不可能的。请在 github community 上查看此主题
您只需在此级别达到变量即可
The workflow is not valid. .github/workflows/so-004-variables-in-trigger.yaml (Line: 7, Col: 9): Unrecognized named-value: 'env'. Located at position 1 within expression: env.default-branch
您可以考虑根据分支名称添加 filterint,例如 here但目前你不能做你想做的。
关于Github 操作 : default branch variable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64781462/