如何跳过拉取请求的默认管道?

T. *_*. Ç 5 bitbucket-pipelines bitbucket-cloud

在我目前正在进行的项目中,我想根据以下规则运行bitbucket管道。

  • 应该为推送到分支的每个提交运行测试和 lint 步骤。
  • 必须为使用 Pull 请求打开的每条记录运行测试覆盖率和 lint 步骤。

这里的问题是,如果我将提交推送到已打开拉取请求的分支,则管道会被触发两次。

pipelines:
  default:
    - step: *lint
    - step: *test
  pull-requests:
    '**':
      - step: *lint
      - step: *test-with-coverage
Run Code Online (Sandbox Code Playgroud)

我寻找一种在拉取请求存在时跳过默认管道的方法,但我找不到它。我愿意接受建议和意见。

小智 -1

pipelines:
  default:
    - step: *lint
    - step: *test
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: never
  pull-requests:
    '**':
      - step: *lint
      - step: *test-with-coverage



Run Code Online (Sandbox Code Playgroud)