Build not triggered on push when using a schedule

Recent commits to the dev branch of our repository are not triggering builds. The latest commit used for any build for that branch is d33c90b from about two weeks ago. Possibly related is a scheduled workflow added in Aug 16; have I possibly botched the config in a way that is preventing builds on a per-commit basis now? Thanks for any ideas.

Hi @ressy,

Looking at the config.yml in your dev branch, I see that there is only one workflow defined and it is the one that is configured to be triggered by a cron schedule. You would need to define an additional workflow for jobs that are to be triggered on a per-commit basis.

Thanks, I see it now, it’s right there in the documentation for workflows:

Note: In CircleCI v2.1, when no workflow is provided in config, an implicit one is used. However, if you declare a workflow to run a scheduled build, the implicit workflow is no longer run. You must add the job workflow to your config in order for CircleCI to also build on every commit.

By default, a workflow is triggered on every git push. To trigger a workflow on a schedule, add the triggers key to the workflow and specify a schedule.

Don’t know how I missed that. So I just need to add a second workflow without the “triggers” key this time, if I understand this right.

Example from one my projects:

  version: 2.1
      - build:
              only: master
      - build
    # The cron format is:
    # min (0-59) hour (0-23) monthday (1-31) month (1-12) weekday (0-6, 0=Sun)
      - schedule:
          cron: "0 0 * * 0"
                - master

Thanks! I added one like build-on-push there, but just specifying a workflow name and a job. Seems like that did the trick.

1 Like

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