Skip to content

Instantly share code, notes, and snippets.

@camdencheek
Created June 8, 2022 14:21
Show Gist options
  • Save camdencheek/93ce09e8501826b31fe879501160a1b6 to your computer and use it in GitHub Desktop.
Save camdencheek/93ce09e8501826b31fe879501160a1b6 to your computer and use it in GitHub Desktop.
with owned_globs as (
select
directory || unnest(regexp_matches(content, '^([^\s]+)\s+@camdencheek)')[1]) as glob,
from files
where name = 'CODEOWNERS'
), owned_files as (
select *
from files
where exists (
select *
from owned_globs
where glob_matches(files.path, owned_globs.globs)
)
)
select path
from owned_files
where content ~ 'your search query';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment