# Use different .travis.yml's for different packages within the repo

**URL:** https://travis-ci.community/t/use-different-travis-ymls-for-different-packages-within-the-repo/8058
**Category:** Travis CI Discussions & Feedback
**Tags:** travis-yml
**Created:** [April 8, 2020, 9:00pm UTC](https://travis-ci.community/t/use-different-travis-ymls-for-different-packages-within-the-repo/8058 "2020-04-08T21:00:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![TheOpti](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@TheOpti](https://travis-ci.community/u/TheOpti)
#### Post date: [April 8, 2020, 9:00pm UTC](https://travis-ci.community/t/use-different-travis-ymls-for-different-packages-within-the-repo/8058/1 "2020-04-08T21:00:56Z")

</div>

Hello there,

I have a problem using travis with lerna (I have two packages inside my repo).

My repo - [https://github.com/TheOpti/my-notes](https://github.com/TheOpti/my-notes) - it’s made with lerna.js and I have two packages: frontend and backend. I would like to start with frontend, so that anytime there is a pull request made which touches frontend code, job is triggered and it will run unit tests and build.

travis.yml file - it’s created and merged into master branch. It’s located in frontend/ package.

My problem - I checked the documentation of travis and I would like to set up a pipeline which will be triggered anytime pull request for “frontend” package is created.

Should it be one travis.yml file for each of the packages? Or should it be only one for one repo? If yes, then how can I parametrize it so that it can run tests for frontend package? For example, I would like to run the job for this package only when branch has name starting with “frontend/”.

---

<div class="post-metadata">

### Author: ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)
#### Post date: [April 8, 2020, 9:22pm UTC](https://travis-ci.community/t/use-different-travis-ymls-for-different-packages-within-the-repo/8058/2 "2020-04-08T21:22:06Z")

</div>

There’s only one controlling `.travis.yml` per repo. It needs to be in its root.

You are free to invoke any custom logic depending on what specifically a commit has changed and whatnot.

Travis aso exposes some information about the properties of the build [via environment variables](https://docs.travis-ci.com/user/environment-variables/#convenience-variables).

---

<div class="post-metadata">

### Author: ![TheOpti](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@TheOpti](https://travis-ci.community/u/TheOpti)
#### Post date: [April 8, 2020, 9:48pm UTC](https://travis-ci.community/t/use-different-travis-ymls-for-different-packages-within-the-repo/8058/3 "2020-04-08T21:48:48Z")

</div>

Thanks for reply. Can you provide an example how can I parametrize job?

For example - one set of steps is run when pull request is made from branch frontend/_, another set is run when base branch is backend/_

---

<div class="post-metadata">

### Author: ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)
#### Post date: [April 8, 2020, 10:06pm UTC](https://travis-ci.community/t/use-different-travis-ymls-for-different-packages-within-the-repo/8058/4 "2020-04-08T22:06:18Z")

</div>

For example:

```auto
- if [[$TRAVIS_BRANCH == frontend/*]]; then ./scenario_one.sh; fi
- if [[$TRAVIS_BRANCH == backend/*]]; then ./scenario_two.sh; fi

```
