Dependency Scanning only on master

I’m running GitLab CI on, and have been using the dependency scanner by adding this to my .gitlab-ci.yml file:

  template: Dependency-Scanning.gitlab-ci.yml

This works great! Except that it’s running on every branch, and while this provides really good information, it takes about 5mins to run, which is too much for a feature branch.

I’ve read the documentation but haven’t found a way to turn off selectively.

Is this possible?

What about

  template: Dependency-Scanning.gitlab-ci.yml

    - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
      when: always
  • Read more about rules here

If my answer solves your problem, please mark as the solution, else provide more information so we can figure this out.

1 Like

I’m not using rules in my .gitlab-ci.yml file yet, but this worked:

    - master

I didn’t know that I could merge configuration into a template! Thank you :slight_smile:

1 Like

I’m glad it worked!

There’s a reason I used “rules” (link)

1 Like