# Conditional Build with PR Label

**URL:** <https://www.finalbuilder.com/forums/t/conditional-build-with-pr-label/6524>\
**Category:** Feature Requests\
**Tags:** continua-ci\
**Created:** [July 16, 2019, 2:04pm UTC](https://www.finalbuilder.com/forums/t/conditional-build-with-pr-label/6524 "2019-07-16T14:04:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dipold](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/dipold/32/1834_2.png) [@dipold](https://www.finalbuilder.com/forums/u/dipold)\
**Post date:** [July 16, 2019, 2:04pm UTC](https://www.finalbuilder.com/forums/t/conditional-build-with-pr-label/6524/1 "2019-07-16T14:04:37Z")

</div>

Hi,

Would be nice a way to indicate whether a particular PR should be built or not. Github allows you to label PRs, so I figured if we could somehow leverage the presence of a particular label or text in commit into the Continua CI build, we would have a good way of letting Continua CI know which PRs to ignore, until they were feature complete and ready to be built.

Some background for the feature:

> **[Conditional Travis Builds with Pull Request Labels](https://guyharwood.co.uk/2018/03/12/conditional-travis-builds-with-pull-request-labels/)**
>
> We have Travis configured to build all Github Pull Requests that will be merged into master. This is very convenient, as all unit and end-to-end tests are run against the resulting merge, giving you an indication of how healthy the final build will...

  

> <https://github.com/travis-ci/travis-ci/issues/5374>
>
> \[ci skip\] is very useful per commit. but sometimes you want to open a pull request early for review but you...

---

<div class="post-metadata">

**Author:** ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)\
**Post date:** [July 17, 2019, 12:58am UTC](https://www.finalbuilder.com/forums/t/conditional-build-with-pr-label/6524/2 "2019-07-17T00:58:47Z")

</div>

Hi Rafael,

You can currently use [Comment Filters](https://wiki.finalbuilder.com/x/AAIK#RepositoryTrigger-CommentPatterns) in Repository Triggers to filter the changesets which trigger a build by matching text in a commit comment.

We have plans utilise the GitHub API more in the future, to pull in extra information like labels.

Meanwhile, you should be able to use the [HTTP Request](https://wiki.finalbuilder.com/x/jgDc) build event handler, to query the GitHub API as in your first link.

You could set this to run `On Build Created` or `On Before Build Queued`, and use the pull request id extracted from the branch in the resource field.

e.g. `/repos/Owner/RepoName/pulls/$Source.RepoName.Branch.Split(\"/\").Last()$`

If you set a variable based on the response, e.g. %PullRequestLabelFound% or %PullRequestLabelId%, this can be used in a [Configuration Condition](https://wiki.finalbuilder.com/x/ngAZ#ConfigurationConditions-Discard) to discard the build if a label is not found.

---

<div class="post-metadata">

**Author:** ![dipold](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/dipold/32/1834_2.png) [@dipold](https://www.finalbuilder.com/forums/u/dipold)\
**Post date:** [July 17, 2019, 12:42pm UTC](https://www.finalbuilder.com/forums/t/conditional-build-with-pr-label/6524/3 "2019-07-17T12:42:43Z")

</div>

Thanks Sparky,

I think your suggestions will meet my needs.

I confess that I’m still at the beginning of the learning curve, trying to understand everything the Continua CI can do.

Best Regards,
