diff --git a/config/settings/base.py b/config/settings/base.py index 6bb71d261..84c207b14 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -499,3 +499,6 @@ def safe_key() -> str: dsn=SENTRY_DSN, integrations=[DjangoIntegration(), RedisIntegration(), RqIntegration()], ) + +# create private repo +ENABLE_CREATE_PRIVATE_REPO = env.bool("ENABLE_CREATE_PRIVATE_REPO", default=False) diff --git a/metecho/api/jobs.py b/metecho/api/jobs.py index afe173067..a79103d06 100644 --- a/metecho/api/jobs.py +++ b/metecho/api/jobs.py @@ -261,7 +261,7 @@ def create_repository( "name": project.repo_name, "description": project.description, "include_all_branches": False, - "private": False, + "private": settings.ENABLE_CREATE_PRIVATE_REPO, } # Sending a POST request to GitHub API response = requests.post(api_url, headers=headers, json=github_data) @@ -273,7 +273,8 @@ def create_repository( else: repo = org.create_repository( - project.repo_name, description=project.description, private=False + project.repo_name, description=project.description, + private=settings.ENABLE_CREATE_PRIVATE_REPO ) team.add_repository(repo.full_name, permission="push") project.repo_id = repo.id