在 GitHub 操作中 'Events that trigger workflows' documentation列出了多种方式,例如在特定分支和特定路径更改上。有没有办法使用AND将这两者结合起来?
据我了解,如果推送是到主分支或特定路径,以下语法将触发运行。是否可以说必须同时满足两个条件才能触发操作?
on:
push:
branches:
- master
paths:
- 'app/*'
Note: I am not looking for a hacky solution like letting it trigger on the path and then checking in the step if the branch is the master branch. I know that this is possible, but you would need to do it for each step and it isn't elegant at all.
最佳答案
我发现的最接近的解决方法是这样的
name: only on master but when the POM changes
on:
push:
paths:
- 'pom.xml'
jobs:
build_pom:
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
steps:
[...]
关于git - 有没有办法使用逻辑 AND 在 GitHub 操作中组合推送标准?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64621707/