# Pushing to develop branch does not trigger build

**URL:** <https://discuss.circleci.com/t/pushing-to-develop-branch-does-not-trigger-build/24940>\
**Category:** Build Environment\
**Tags:** php\
**Created:** [September 6, 2018, 3:03pm UTC](https://discuss.circleci.com/t/pushing-to-develop-branch-does-not-trigger-build/24940 "2018-09-06T15:03:44Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattsches](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mattsches/32/19092_2.png) [@mattsches](https://discuss.circleci.com/u/mattsches)\
**Post date:** [September 6, 2018, 3:03pm UTC](https://discuss.circleci.com/t/pushing-to-develop-branch-does-not-trigger-build/24940/1 "2018-09-06T15:03:44Z")

</div>

Hi,  
I set up a simple PHP project on GitHub using the git-flow model. Currently, I have only two branches `master` and `develop`. I’m frequently pushing to `develop` and only want `develop` to be built currently, but the build on CircleCI is not triggered. (I can start a build using the API, though)

Here is my config that is mainly based on the default config, what am I doing wrong?

```
version: 2
jobs:
  build:
    docker:
      - image: circleci/php:7.2.9-apache-node-browsers
    branches:
      only:
        - develop
    working_directory: ~/repo
    steps:
      - checkout
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "composer.json" }}
          - v1-dependencies-
      - run: composer install -n --prefer-dist
      - save_cache:
          paths:
            - ./vendor
          key: v1-dependencies-{{ checksum "composer.json" }}
      - run: ./vendor/bin/phpunit

```

Ping @FelicianoTech

Thanks for any help,  
Matthias

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [September 6, 2018, 3:07pm UTC](https://discuss.circleci.com/t/pushing-to-develop-branch-does-not-trigger-build/24940/2 "2018-09-06T15:07:14Z")

</div>

From [the docs](https://circleci.com/docs/2.0/configuration-reference/#branches):

> A job that was not executed due to configured rules will show up in the list of jobs in UI, but will be marked as skipped.

Do you get this?

---

<div class="post-metadata">

**Author:** ![mattsches](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mattsches/32/19092_2.png) [@mattsches](https://discuss.circleci.com/u/mattsches)\
**Post date:** [September 6, 2018, 3:15pm UTC](https://discuss.circleci.com/t/pushing-to-develop-branch-does-not-trigger-build/24940/3 "2018-09-06T15:15:03Z")

</div>

> [@halfer](#):
>
> > A job that was not executed due to configured rules will show up in the list of jobs in UI, but will be marked as skipped.
> 
> Do you get this?

No, the last job in the list is 24h old. My last push to ‘develop’ happened an hour ago.

---

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/felicianotech/32/21348_2.png) [@FelicianoTech](https://discuss.circleci.com/u/FelicianoTech)\
**Post date:** [September 6, 2018, 3:20pm UTC](https://discuss.circleci.com/t/pushing-to-develop-branch-does-not-trigger-build/24940/4 "2018-09-06T15:20:07Z")

</div>

Use the config below but make sure the file is available in both branches:

```auto
workflows:
  version: 2
  main:
    jobs:
      - build:
          filters:
            branches:
              only: develop

version: 2
  jobs:
    build:
      docker:
        - image: circleci/php:7.2.9-apache-node-browsers
      steps:
        - checkout
        - restore_cache:
            keys:
              - v1-dependencies-{{ checksum "composer.json" }}
              - v1-dependencies-
        - run: composer install -n --prefer-dist
        - save_cache:
            paths:
              - ./vendor
            key: v1-dependencies-{{ checksum "composer.json" }}
        - run: ./vendor/bin/phpunit

```

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [September 6, 2018, 3:22pm UTC](https://discuss.circleci.com/t/pushing-to-develop-branch-does-not-trigger-build/24940/5 "2018-09-06T15:22:19Z")

</div>

I was going to suggest using the workflows/branches device, @FelicianoTech. Does the job-level key not work correctly?

---

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/felicianotech/32/21348_2.png) [@FelicianoTech](https://discuss.circleci.com/u/FelicianoTech)\
**Post date:** [September 6, 2018, 3:25pm UTC](https://discuss.circleci.com/t/pushing-to-develop-branch-does-not-trigger-build/24940/6 "2018-09-06T15:25:30Z")

</div>

We’re about to find out. It should in that we have it listed in the Docs. If this works, then perhaps something is wrong with the job-level version and I’ll need to report that internally.

Personally, I also prefer the Workflows version since it’s easier to scale to larger configs in the future.

---

<div class="post-metadata">

**Author:** ![mattsches](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mattsches/32/19092_2.png) [@mattsches](https://discuss.circleci.com/u/mattsches)\
**Post date:** [September 6, 2018, 3:34pm UTC](https://discuss.circleci.com/t/pushing-to-develop-branch-does-not-trigger-build/24940/7 "2018-09-06T15:34:10Z")

</div>

Adjusted the config you posted, and now everything seems to work as expected 🙂 Thanks for your help!

```
version: 2
jobs:
  build:
    docker:
    - image: circleci/php:7.2.9-apache-node-browsers
    steps:
    - checkout
    - restore_cache:
        keys:
        - v1-dependencies-{{ checksum "composer.json" }}
        - v1-dependencies-
    - run: composer install -n --prefer-dist
    - save_cache:
        paths:
        - ./vendor
        key: v1-dependencies-{{ checksum "composer.json" }}
    - run: ./vendor/bin/phpunit

workflows:
  version: 2
  main:
    jobs:
    - build:
        filters:
          branches:
            only: develop
```

---

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/felicianotech/32/21348_2.png) [@FelicianoTech](https://discuss.circleci.com/u/FelicianoTech)\
**Post date:** [September 6, 2018, 3:37pm UTC](https://discuss.circleci.com/t/pushing-to-develop-branch-does-not-trigger-build/24940/8 "2018-09-06T15:37:25Z")

</div>

I’ll look into why the way you were doing it didn’t work but otherwise I’m glad it works for you now.

Update:

FWIW, I tried out a simplified version of your original config. On a branch named [`2.0-docker`](https://circleci.com/gh/felicianotech/cci-testing-pub/692) and a branch named [`develop`](https://circleci.com/gh/felicianotech/cci-testing-pub/693) and it worked as expected. Strange.

If you prefer using your original method over workflows, at this point I’d suggest contacting Support and sharing your original config and example build URLs that didn’t work as expected.

---

<div class="post-metadata">

**Author:** ![mattsches](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mattsches/32/19092_2.png) [@mattsches](https://discuss.circleci.com/u/mattsches)\
**Post date:** [September 6, 2018, 8:48pm UTC](https://discuss.circleci.com/t/pushing-to-develop-branch-does-not-trigger-build/24940/9 "2018-09-06T20:48:30Z")

</div>

I was going to take a look at workflows sooner or later anyway, so I’m fine with this solution. Will probably extend the config step by step, so again thanks for the support!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [December 5, 2018, 8:48pm UTC](https://discuss.circleci.com/t/pushing-to-develop-branch-does-not-trigger-build/24940/10 "2018-12-05T20:48:35Z")

</div>

Closed on December 5, 2018, 8:48pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
