Repo Grep Checks
Verify the existence or contents of files or folders in your repo.
After setting up a Git Repository Integration, OpsLevel can continuously scan your code repositories and verify all of the operational best practices you’ve defined.
Repo Grep Checks operate very similarly to Repo File Checks. As such, we recommend reading the docs on Repo File and Repo Search Checks before beginning to experiment further with Repo Grep Checks.
The Repo Grep Check
With Repo Grep Checks, you can verify the existence or contents of files or folders in your repo. While Repo File and Repo Search Checks can resolve most use-cases, there are certain circumstances with which Repo Grep Checks can offer additional capabilities. For example:
- Searching multiple specific files
- Searching using glob patterns
- Searching for certain special characters
- Repo Grep checks support exists, fixed-string, regex, and version constraints
Repo Grep Check Examples
Ensure services are declaring code ownership
You may have a mandate for all services to declare code owners within their repo. While these could exist in a
/CODEOWNERS file, there might be situations where a legacy service define owners in a
.github folder as well. If both of these are permissible, you can use Repo Grep Checks to ensure at least one the files exist:
npm. You can use Repo Grep Checks to make sure this policy is being followed:
Ensure Python services no longer use the deprecated "plank" library
Say you have a policy that all Python services can no longer use a deprecated library called
plank. You can use Repo Grep Checks to enforce this policy:
|Predicate||Search Term||File Paths|
Those were just some examples to get the creative juices flowing. But there’s tons more you can do with Repo Grep Checks. If you have any questions, or just come up with some interesting checks you want to share, hit us up at [email protected].
Updated 3 months ago