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

#1

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 ?

0 Likes

#2

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:

0 Likes

#3

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

Thanks !

1 Like

#4

@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

0 Likes

#5

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.

0 Likes

#6

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.

0 Likes