Trigger .gitlab-ci.yml job at specific branch, schedule and changes in specific folder

Hello,

I am trying to trigger a job I have defined in .gitlab-ci.yml in the following way:

  • First option - to run only in develop branch when changes are made to the files in “help_docs” directory or when changes are made in gitlab-ci.yml file itself
  • Second option - run according to the schedule I have set

This is my syntax, which appears correct. But job is not starting - for example when editing .gitlab-ci.yml, pipeline doesn’t start.

Check_Help_Docs:

  only:

    refs:

      - develop

      - schedules

    changes:

      - help_docs/*

      - gitlab-ci.yml

I was trying to search the forum with similar cases, but couldn’t find similar. Thank you for your help!

Hello & welcome to GitLab’s forums :slight_smile:

Did you set a custom path for your CI config? Because you wrote .gitlab-ci.yml, but defined gitlab-ci.yml (without .) :wink:

I tested your Check_Help_Docs job just now on a test instance, and it was triggered just fine when editing a help_docs/test.txt file.

Please also note that the only syntax will be deprecated. Here are some examples on how to transition them to the new rules syntax.

Hope this helps :slight_smile: