# Conditional pipeline uploads

**URL:** <https://forum.buildkite.community/t/conditional-pipeline-uploads/2072>\
**Category:** General\
**Created:** [June 2, 2022, 5:54pm UTC](https://forum.buildkite.community/t/conditional-pipeline-uploads/2072 "2022-06-02T17:54:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/joe/32/1080_2.png) [@Joe](https://forum.buildkite.community/u/Joe)\
**Post date:** [June 2, 2022, 5:54pm UTC](https://forum.buildkite.community/t/conditional-pipeline-uploads/2072/1 "2022-06-02T17:54:34Z")

</div>

I have this script to filters certain files when commited to not upload our pr-validation checks pipeline.  
Originally, I wanted to run the script this way.  
`script.sh && buildkite-agent pipeline upload pipeline.yml`

but in Buildkite UI, We are only allowed to use  
`buildkite-agent pipeline upload`

I can do is create anotherpipeline.yml and call it in the Buildkite UI.

```auto
#anotherpipeline.yml
steps:
 - command: script.sh && buildkite-agent pipeline upload pipeline.yml

```

Is there a better way of doing this, I do not like to create anotherpipeline yml file with only one command step for the sake of running the script whether to upload the pipeline,yml

---

<div class="post-metadata">

**Author:** ![jeremy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/jeremy/32/1040_2.png) [@jeremy](https://forum.buildkite.community/u/jeremy)\
**Post date:** [June 2, 2022, 10:09pm UTC](https://forum.buildkite.community/t/conditional-pipeline-uploads/2072/2 "2022-06-02T22:09:09Z")

</div>

Hi @Joe, great question!

You should be able to run both script.sh and the pipeline upload in the steps defined in the UI.  
Another option might be to have that script run as a [hook](https://buildkite.com/docs/agent/v3/hooks#job-lifecycle-hooks).
