Skip to content

Commit 77767fa

Browse files
authored
feat: support extra maintainers files with specific check for readme.md [CM-1032] (#3898)
1 parent 50eb125 commit 77767fa

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

services/apps/git_integration/src/crowdgit/services/maintainer/maintainer_service.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ class MaintainerService(BaseService):
5959
"CODEOWNERS",
6060
".github/MAINTAINERS.md",
6161
".github/CONTRIBUTORS.md",
62+
"GOVERNANCE.md",
63+
"README.md",
64+
"SECURITY-INSIGHTS.md",
6265
]
6366

6467
def make_role(self, title: str):
@@ -359,6 +362,11 @@ async def find_maintainer_file(self, repo_path: str, owner: str, repo: str):
359362
self.logger.info(f"maintainer file: {file_path} found in repo")
360363
async with aiofiles.open(file_path, "r", encoding="utf-8") as f:
361364
content = await f.read()
365+
366+
if file.lower() == "readme.md" and "maintainer" not in content.lower():
367+
self.logger.info(f"Skipping {file}: no maintainer-related content found")
368+
continue
369+
362370
return file, base64.b64encode(content.encode()).decode(), 0
363371

364372
self.logger.warning("No maintainer files found using the known file names.")
@@ -370,6 +378,13 @@ async def find_maintainer_file(self, repo_path: str, owner: str, repo: str):
370378
if await aiofiles.os.path.isfile(file_path):
371379
async with aiofiles.open(file_path, "r", encoding="utf-8") as f:
372380
content = await f.read()
381+
382+
if file_name.lower() == "readme.md" and "maintainer" not in content.lower():
383+
self.logger.info(
384+
f"AI suggested {file_name}, but it has no maintainer-related content. Skipping."
385+
)
386+
return None, None, ai_cost
387+
373388
self.logger.info(f"\nMaintainer file found: {file_name}")
374389
return file_name, base64.b64encode(content.encode()).decode(), ai_cost
375390

0 commit comments

Comments
 (0)