buildkite / feedback

Got feedback? Please let us know!
https://buildkite.com
25 stars 24 forks source link

Bug: Conditional `build.pull_request.draft` is not evaluating correctly #535

Open jeffistyping opened 2 years ago

jeffistyping commented 2 years ago

Hello!

I'm trying to use if !build.pull_request.draft to trigger builds only on open (non-draft) PRs and I found that the conditional may not be evaluating correctly. It appears that despite the state of the PR (tried it in open and in draft PR), if build.pull_request.draft is set, the steps will not run. if if !build.pull_request.draft is set, the steps will run but also regardless of whatever the PR's draft status is. Our ci.yaml is being parsed in properly and that the conditional is loaded correctly into the step.

Approximately how our ci.yaml looks


steps:
  - label: STEP THAT WILL ALWAYS RUN
    key: "test"
    agents:
      queue: "foo"
    timeout_in_minutes: 30
    command: |
      <OUR COMMANDS>
    if: "!build.pull_request.draft"
  - label: STEP THAT WILL NEVER RUN
    key: "test2"
    agents:
      queue: "foo"
    timeout_in_minutes: 30
    command: |
      <OUR COMMANDS>
    if: "build.pull_request.draft"