Fix codeowners script for nested files (#68590)

This commit is contained in:
Marc Mueller 2022-03-29 13:17:49 +02:00 committed by GitHub
parent d9a6371679
commit c3d937fb0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1205 additions and 1194 deletions

2372
CODEOWNERS

File diff suppressed because it is too large Load diff

View file

@ -8,28 +8,34 @@ BASE = """
# People marked here will be automatically requested for a review # People marked here will be automatically requested for a review
# when the code that they own is touched. # when the code that they own is touched.
# https://github.com/blog/2392-introducing-code-owners # https://github.com/blog/2392-introducing-code-owners
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
# Home Assistant Core # Home Assistant Core
setup.cfg @home-assistant/core setup.cfg @home-assistant/core
homeassistant/*.py @home-assistant/core /homeassistant/*.py @home-assistant/core
homeassistant/helpers/* @home-assistant/core /homeassistant/helpers/ @home-assistant/core
homeassistant/util/* @home-assistant/core /homeassistant/util/ @home-assistant/core
# Home Assistant Supervisor # Home Assistant Supervisor
build.json @home-assistant/supervisor build.json @home-assistant/supervisor
machine/* @home-assistant/supervisor /machine/ @home-assistant/supervisor
rootfs/* @home-assistant/supervisor /rootfs/ @home-assistant/supervisor
Dockerfile @home-assistant/supervisor /Dockerfile @home-assistant/supervisor
# Other code # Other code
homeassistant/scripts/check_config.py @kellerza /homeassistant/scripts/check_config.py @kellerza
# Integrations # Integrations
""".strip() """.strip()
INDIVIDUAL_FILES = """ INDIVIDUAL_FILES = """
# Individual files # Individual files
homeassistant/components/demo/weather @fabaff /homeassistant/components/demo/weather.py @fabaff
"""
REMOVE_CODEOWNERS = """
# Remove codeowners from files
/homeassistant/components/*/translations/
""" """
@ -54,12 +60,13 @@ def generate_and_validate(integrations: dict[str, Integration], config: Config):
"codeowners", "Code owners need to be valid GitHub handles." "codeowners", "Code owners need to be valid GitHub handles."
) )
parts.append(f"homeassistant/components/{domain}/* {' '.join(codeowners)}") parts.append(f"/homeassistant/components/{domain}/ {' '.join(codeowners)}")
if (config.root / "tests/components" / domain / "__init__.py").exists(): if (config.root / "tests/components" / domain / "__init__.py").exists():
parts.append(f"tests/components/{domain}/* {' '.join(codeowners)}") parts.append(f"/tests/components/{domain}/ {' '.join(codeowners)}")
parts.append(f"\n{INDIVIDUAL_FILES.strip()}") parts.append(f"\n{INDIVIDUAL_FILES.strip()}")
parts.append(f"\n{REMOVE_CODEOWNERS.strip()}")
return "\n".join(parts) return "\n".join(parts)