# Custom 'when' or events

**URL:** <https://drone.discourse.group/t/custom-when-or-events/10384>\
**Category:** Drone Support\
**Created:** [April 18, 2017, 2:23pm UTC](https://drone.discourse.group/t/custom-when-or-events/10384 "2017-04-18T14:23:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [April 18, 2017, 9:34pm UTC](https://drone.discourse.group/t/custom-when-or-events/10384/2 "2017-04-18T21:34:52Z")

</div>

> [@Virtual HarnessU's - June 2020](https://drone.discourse.group/t/virtual-harnessus-june-2020/443/1):
>
> Let’s say I want to execute build step if commit message contains “BUILD\_ME”.

this is not possible, but if you want to manually trigger builds you can use `drone deploy`. You pick and existing build number, and you promote it. Example command signature:

```plaintext
drone deploy <repo> <build number> <environment>

```

Example command with dummy data

```plaintext
drone deploy octocat/hello-world 22 prod

```

Then in your yaml you can specify that certain steps should only execute for deployment events and for certain environments. For example:

```plaintext
pipeline:
  ...
  docker_stage:
    image: plugins/docker
    when:
      event: deployment
      environment: staging
  docker_prod:
    image: plugins/docker
    when:
      event: deployment
      environment: production

```

Note that you will need to enable deployment events for your repository for this to work. You can enable deployment events by going to your repository settings in Drone.

---

_[View the full topic](https://drone.discourse.group/t/custom-when-or-events/10384)._
