-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
8 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,15 +55,15 @@ def github_create_pr(repository: str, branch_name: str, base_name: str, version: | |
url = "https://api.github.com/repos/DataDog/" + repository + "/pulls" | ||
response = requests.post(url=url, headers=headers, data=data) | ||
if response.status_code == 201: | ||
print("✔ Pull Request created successfully") | ||
print("Pull Request created successfully") | ||
return 0 | ||
else: | ||
print("✘ pull request failed " + str(response.status_code) + '\n' + response.text) | ||
print("pull request failed " + str(response.status_code) + '\n' + response.text) | ||
return 1 | ||
|
||
|
||
def generate_target_code(target: str, temp_dir_path: str, version: str): | ||
print("… Generating code with version " + version) | ||
print("Generating code with version " + version) | ||
file_path = FILE_PATH[target] | ||
target_file = os.path.join(temp_dir_path, file_path) | ||
prefix = PREFIX[target] | ||
|
@@ -80,19 +80,19 @@ def generate_target_code(target: str, temp_dir_path: str, version: str): | |
|
||
|
||
def git_clone_repository(repo_name: str, gh_token: str, temp_dir_path: str) -> Tuple[Repo, str]: | ||
print("… Cloning repository " + repo_name) | ||
print("Cloning repository " + repo_name) | ||
url = "https://" + gh_token + ":[email protected]/DataDog/" + repo_name | ||
repo = Repo.clone_from(url, temp_dir_path) | ||
base_name = repo.active_branch.name | ||
return repo, base_name | ||
|
||
|
||
def git_push_changes(repo: Repo, version: str): | ||
print("… Committing changes") | ||
print("Committing changes") | ||
repo.git.add(update=True) | ||
repo.index.commit("Update DD SDK to " + version) | ||
|
||
print("- Pushing branch") | ||
print("Pushing branch") | ||
origin = repo.remote(name="origin") | ||
repo.git.push("--set-upstream", "--force", origin, repo.head.ref) | ||
|
||
|
@@ -105,13 +105,13 @@ def update_dependant(version: str, target: str, gh_token: str) -> int: | |
|
||
repo, base_name = git_clone_repository(repo_name, gh_token, temp_dir_path) | ||
|
||
print("… Creating branch " + branch_name) | ||
print("Creating branch " + branch_name) | ||
repo.git.checkout('HEAD', b=branch_name) | ||
|
||
generate_target_code(target, temp_dir_path, version) | ||
|
||
if not repo.is_dirty(): | ||
print("∅ Nothing to commit, all is in order…") | ||
print("Nothing to commit, all is in order-") | ||
return 0 | ||
|
||
git_push_changes(repo, version) | ||
|