Skip to content

Commit 2bfce70

Browse files
authored
Merge pull request #1 from dixonjoel/users/jdixon/codeowners-updates
Update CODEOWNERS to be the administrators of the template repo and C…
2 parents 3aeaaa7 + 78a7af3 commit 2bfce70

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
{{code_owner_handle}}
2-
{{code_owner_handle_2}}
1+
@dixonjoel

.github/CODEOWNERS_TEMPLATE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{code_owner_handle}}
2+
{{code_owner_handle_2}}

replace_template_vars.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,26 @@ def replace_in_file(file_path: Path, variables: Dict[str, str]) -> None:
5757
print(f"Error updating {file_path}: {e}")
5858

5959

60+
def handle_codeowners_file(base_path: Path) -> None:
61+
"""Handle CODEOWNERS file transformation."""
62+
github_path = base_path / ".github"
63+
if not github_path.exists():
64+
return
65+
66+
codeowners_path = github_path / "CODEOWNERS"
67+
codeowners_template_path = github_path / "CODEOWNERS_TEMPLATE"
68+
69+
# Remove existing CODEOWNERS (if it exists)
70+
if codeowners_path.exists():
71+
codeowners_path.unlink()
72+
print(f"Removed: {codeowners_path}")
73+
74+
# Rename CODEOWNERS_TEMPLATE to CODEOWNERS
75+
if codeowners_template_path.exists():
76+
codeowners_template_path.rename(codeowners_path)
77+
print(f"Renamed: {codeowners_template_path} -> {codeowners_path}")
78+
79+
6080
def rename_directories(base_path: Path, variables: Dict[str, str]) -> None:
6181
"""Rename directories that contain template variables."""
6282
# Rename source directories
@@ -86,7 +106,7 @@ def rename_directories(base_path: Path, variables: Dict[str, str]) -> None:
86106
print(f"Renamed: {old_workflow} -> {new_workflow}")
87107

88108

89-
def main():
109+
def main() -> int:
90110
"""Main function."""
91111
parser = argparse.ArgumentParser(description="Replace template variables")
92112
parser.add_argument("--template-dir", default=".", help="Template directory path")
@@ -138,6 +158,10 @@ def main():
138158
print("\nRenaming directories...")
139159
rename_directories(output_dir, variables)
140160

161+
# Handle CODEOWNERS file transformation
162+
print("\nHandling CODEOWNERS files...")
163+
handle_codeowners_file(output_dir)
164+
141165
print("\nTemplate replacement complete!")
142166
print(f"Project created in: {output_dir}")
143167
print("\nNext steps:")

0 commit comments

Comments
 (0)