# Define conditional block step in buildkite pipeline

**URL:** <https://forum.buildkite.community/t/define-conditional-block-step-in-buildkite-pipeline/4292>\
**Category:** Pipelines\
**Created:** [March 6, 2025, 7:46pm UTC](https://forum.buildkite.community/t/define-conditional-block-step-in-buildkite-pipeline/4292 "2025-03-06T19:46:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nagarwal](https://avatars.discourse-cdn.com/v4/letter/n/5f9b8f/32.png) [@nagarwal](https://forum.buildkite.community/u/nagarwal)\
**Post date:** [March 6, 2025, 7:46pm UTC](https://forum.buildkite.community/t/define-conditional-block-step-in-buildkite-pipeline/4292/1 "2025-03-06T19:46:36Z")

</div>

I have a use case where on every commit on a branch it automatically trigger the deployment pipeline as well.

We have use case where automatic deployment trigger happen only on n commits on a branch and after that there will be a manual block step.

Wonder, if I can write a conditional block step like this? I already have a script which determine if current commit on branch is within nth commit or not.

---

<div class="post-metadata">

**Author:** ![suma](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/suma/32/1306_2.png) [@suma](https://forum.buildkite.community/u/suma)\
**Post date:** [March 6, 2025, 8:08pm UTC](https://forum.buildkite.community/t/define-conditional-block-step-in-buildkite-pipeline/4292/2 "2025-03-06T20:08:28Z")

</div>

Hi @nagarwal 👋,

This is Suma from Buildkite support team. Thank you for reaching out to us with your question.

One way to achieve this is to have a script which does the check for the commits which is something you already have and then based on the result of the check dynamically upload a pipeline with block step or trigger step to deployment pipeline.

Please let us know if you have any questions.

Thanks,  
Suma
