Skip to content

Commit

Permalink
feat(projects): allow importing additional items from GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
nejch authored and JohnVillalovos committed Apr 11, 2023
1 parent 511764d commit ce84f2e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions gitlab/v4/objects/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,8 @@ def import_github(
repo_id: int,
target_namespace: str,
new_name: Optional[str] = None,
github_hostname: Optional[str] = None,
optional_stages: Optional[Dict[str, bool]] = None,
**kwargs: Any,
) -> Union[Dict[str, Any], requests.Response]:
"""Import a project from Github to Gitlab (schedule the import)
Expand All @@ -1126,6 +1128,9 @@ def import_github(
repo_id: Github repository ID
target_namespace: Namespace to import repo into
new_name: New repo name (Optional)
github_hostname: Custom GitHub Enterprise hostname.
Do not set for GitHub.com. (Optional)
optional_stages: Additional items to import. (Optional)
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
Expand Down Expand Up @@ -1156,9 +1161,12 @@ def import_github(
"personal_access_token": personal_access_token,
"repo_id": repo_id,
"target_namespace": target_namespace,
"new_name": new_name,
"github_hostname": github_hostname,
"optional_stages": optional_stages,
}
if new_name:
data["new_name"] = new_name
data = utils.remove_none_from_dict(data)

if (
"timeout" not in kwargs
or self.gitlab.timeout is None
Expand Down

0 comments on commit ce84f2e

Please sign in to comment.