如何根据条件取消/不执行 Bitbucket Pipelines 构建?

Ale*_*lla 5 bash yaml bitbucket bitbucket-pipelines

我想更新我的 yml 文件以忽略某些用户的提交。这可能吗?有类似的解决方案吗?理想情况下,我什至不想首先触发构建。

yml 文件的伪代码示例(忽略语法,我只是展示我想要做的事情)

user: git show -s --format='%ae' $BITBUCKET_COMMIT
unwantedUser: "person@mail.com"

pipelines:
  tags:
    '**' && user != unwantedUser: # any tags by wanted users
      - step:
          script:
            (...)
Run Code Online (Sandbox Code Playgroud)

实现这一目标的实际语法是什么?

Ale*_*lla 12

我最终[skip ci]在提交消息中包含了该字符串,以避免触发管道。

文档中:

我可以在不触发管道的情况下提交吗?是的。如果您不想在通常会触发管道的提交上运行管道,则可以在 HEAD 提交的提交消息中的任意位置包含 [skip ci] 或 [ci skip]。消息中包含 [skip ci] 或 [ci skip] 的任何提交都会被管道忽略。