diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index cfb31cb..10288c4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1 @@ -{{code_owner_handle}} -{{code_owner_handle_2}} \ No newline at end of file +@dixonjoel \ No newline at end of file diff --git a/.github/CODEOWNERS_TEMPLATE b/.github/CODEOWNERS_TEMPLATE new file mode 100644 index 0000000..cfb31cb --- /dev/null +++ b/.github/CODEOWNERS_TEMPLATE @@ -0,0 +1,2 @@ +{{code_owner_handle}} +{{code_owner_handle_2}} \ No newline at end of file diff --git a/replace_template_vars.py b/replace_template_vars.py index e08a70b..6b35d7f 100644 --- a/replace_template_vars.py +++ b/replace_template_vars.py @@ -57,6 +57,26 @@ def replace_in_file(file_path: Path, variables: Dict[str, str]) -> None: print(f"Error updating {file_path}: {e}") +def handle_codeowners_file(base_path: Path) -> None: + """Handle CODEOWNERS file transformation.""" + github_path = base_path / ".github" + if not github_path.exists(): + return + + codeowners_path = github_path / "CODEOWNERS" + codeowners_template_path = github_path / "CODEOWNERS_TEMPLATE" + + # Remove existing CODEOWNERS (if it exists) + if codeowners_path.exists(): + codeowners_path.unlink() + print(f"Removed: {codeowners_path}") + + # Rename CODEOWNERS_TEMPLATE to CODEOWNERS + if codeowners_template_path.exists(): + codeowners_template_path.rename(codeowners_path) + print(f"Renamed: {codeowners_template_path} -> {codeowners_path}") + + def rename_directories(base_path: Path, variables: Dict[str, str]) -> None: """Rename directories that contain template variables.""" # Rename source directories @@ -86,7 +106,7 @@ def rename_directories(base_path: Path, variables: Dict[str, str]) -> None: print(f"Renamed: {old_workflow} -> {new_workflow}") -def main(): +def main() -> int: """Main function.""" parser = argparse.ArgumentParser(description="Replace template variables") parser.add_argument("--template-dir", default=".", help="Template directory path") @@ -138,6 +158,10 @@ def main(): print("\nRenaming directories...") rename_directories(output_dir, variables) + # Handle CODEOWNERS file transformation + print("\nHandling CODEOWNERS files...") + handle_codeowners_file(output_dir) + print("\nTemplate replacement complete!") print(f"Project created in: {output_dir}") print("\nNext steps:")