Skip to content

Commit

Permalink
Authenticated upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
lmazuel committed Mar 19, 2018
1 parent 9b17e3f commit 345117e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion swaggertosdk/restapi/github_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
DashboardCommentableObject,
manage_git_folder,
configure_user,
user_from_token
)

from git import Repo
Expand Down Expand Up @@ -266,7 +267,15 @@ def clean_sdk_pr(rest_pr, sdk_repo):
# Delete the branch. I need to clone the
#
gh_token = os.environ["GH_TOKEN"]
upstream_url = 'https://github.com/{}.git'.format(sdk_pr.head.repo.full_name)
login = user_from_token(gh_token).login
credentials_part = '{user}:{token}@'.format(
user=login,
token=gh_token
)
upstream_url = 'https://{credentials}github.com/{sdk_git_id}.git'.format(
credentials=credentials_part,
sdk_git_id=sdk_pr.head.repo.full_name
)
with tempfile.TemporaryDirectory() as temp_dir, \
manage_git_folder(gh_token, Path(temp_dir) / Path("sdk"), sdk_repo.full_name) as sdk_folder:

Expand Down

0 comments on commit 345117e

Please sign in to comment.