Skip to content

Commit

Permalink
Merge pull request #2158 from SFDO-Tooling/feature/enable_private_repo
Browse files Browse the repository at this point in the history
@W-14865432 - Create private repo
  • Loading branch information
vsbharath authored Jan 24, 2024
2 parents 0728e2b + ea55417 commit f60024a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 3 additions & 2 deletions metecho/api/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit f60024a

Please sign in to comment.