Conditional logic between event and branch in when bloc

I want to launch task on: pull_request AND push on specific branch.

I try:

when:
event: [tag, pull_request, push]
branch: [master, develop, staging]

If I activate Repository Hooks on pull request and push, when I create pull request Drone launch two job(with one never start, stay in grey)…

Reproduce bug with:

  • Use this “when” config
  • Submit pull request
    => See two job (on push an other on pr) the first job in push hold on pending status

My target is (only one build once):

  • Build on pr
  • Build on push specific branch(aka master, develop, staging)

The branch when clause uses the pull request target branch, not the source branch. There is an open issue to enable when conditions with the source branch that you can subscribe to [1].

Please also note that you cannot reliably use tag in conjunction with the branch clause since tags are a pointer to a commit, and not a branch [2][3].

[1] https://github.com/drone/drone/issues/2222
[2] [SOLVED] Using conditions with plugins/gcr and tags
[3] Two builds fire and tagged event is empty