How to run on all pushes except to draft PRs?

Similar to this question, I would like to exclude draft pull requests. The difference is that I have on: [push], and I don’t want to exclude non-PR pushes.

Would if: ${{ !github.event.pull_request.draft }} work? I wouldn’t expect github.event.pull_request to be set for all push events (is it even set for any push events?), and I don’t know whether referring to a non-existing child item results in an error, or whether it will resolve into some falsy value.

1 Like