Ignore build requests when GitHub's Pull Request is a draft

It would be great to ignore build requests on draft PRs from GitHub. That would avoid busying the CI with builds that might not even compile.
Even if it did, because we know we’ll have to push more commits later, why bother building an unfinished PR ?

Hi @thierrylee!

Thanks a lot for the #feature-request! Definitely makes a lot of sense, although I’m not sure how possible this is, since this feature is relatively new and based on the lack of settings for drafts in webhooks to me it seems like GitHub might be handling them as identical events :confused:

Yeah that makes sense. I’ll ask GitHub and let you know as soon as I get news about it.

Thanks !

1 Like

@bitce from inspecting our pull request webhook deliveries, it looks like GitHub now includes the draft status in pull request webhook payloads. Any chance this could be revisited? Alternatively, if you provided the webhook payload as an environment variable, we could check this and other things directly.

Cheers, Michael

Quite old issue, but here are my 2 cents:

I would say that most of the draft PRs which I’m involved in are marked as drafts because the author explicitly wants to run CI but do not necessarily want a code review.
Very often such PRs are not updated by pushing more commits. If CI build passes they are marked non-draft.
The opposite of what @thierrylee said.

If one don’t want to run the CI build he/she can just push the desired branch without creating a PR.

However, I can imagine that somewhere the workflow may be different and code review is before CI build.

A workaround is to add [ci skip] to the PR title.

Our use case is that we want to encourage the team to open pull requests early as a place for things like strategy discussion. While the pull request is in draft, we want to lint and run tests but only distribute builds for QA and manual testing when a pull request is ready for review.

As the draft status (or even better the webhook payload) isn’t available at the moment, I’m currently making an API call to check the draft status, which is a bit hacky. We then set an envman value and skip the build steps based on the value.

This isn’t skipping the build entirely as per the OP, so the [ci skip] hack doesn’t suit.

Bumping this up, it would be nice to have an option to fire triggers or not on draft PRs.

Hello @ayn
Thank you for reaching out to Bitrise.
Could you please explain the use case of the feature so that we can inform the product team about regarding feature?


1 Like

Bumping this up again since the draft status is available in the webhook payload now

1 Like