When you define a basepath in your entity’s x-cortex-git configuration, all Git-based CQL queries (such as git.codeSearch(), git.fileExists(), and git.fileContents()) are evaluated relative to that basepath. This means you cannot access files in the repository root by default, which can be problematic if your scorecard needs to check for files or code in root-level directories (ex: .github/actions or .github/workflows).
Example:
If your git configuration looks like this:
x-cortex-git:
github:
basepath: test
repository: my-repo/platform
A CQL query like the following will only search within the basepath, not the repo root:
git.codeSearch(query = "platform-submitter/.github/actions/security", inFile = true, path = ".github/workflows", language = "yaml").length > 0
Our suggested workaround:
To bypass the basepath and access files at the repository root, you can explicitly reference the repository in your CQL query. This is done by using the git("github:...") expression and dynamically pulling the repository name from your entity’s YAML:
git("github:" + entity.descriptor().info.`x-cortex-git`.github.repository) .codeSearch(query = "platform-submitter/.github/actions/security", inFile = true, path = ".github/workflows", language = "yaml").length > 0This pattern allows you to search the entire repository, including the root, regardless of the basepath set on the entity. The entity.descriptor().info.x-cortex-git.github.repository expression ensures the query dynamically uses the correct repository for each entity.