Include file with rules

I am trying to make a .gitlab-ci.yml file that will include application specific .gitlab-ci.yml files based on files that change in a specific path. here is what I have so far

# changes in the admin server file structure..
include:
  - local: "admin_server/.gitlab-ci.yml"
    rules:
      - if: $CI_COMMIT_BRANCH == "main"
        changes:
          - admin_server/*

invalid include rule: {:if=>"$CI_COMMIT_BRANCH == \"main\"", :changes=>["admin_server/*"]}

I can’t for the life of me figure what the error is. I want this to only happen when we have a commit on main and only if a file in this path change. Docs make it pretty clear this is how to do it. Can anyone offer some insight.

thanks
Brad

The issue is that changes is not supported for rules with include.

It’s documented here, in 2nd last paragraph.

I think it’s probably not possible to use changes with include:rules, even though the docs make it seem like it might be. I don’t think there’s an issue up for this but it would be a good idea to raise one!