Fix create rule command in create_new_rspec github workflow

This commit is contained in:
Nicolas Harraudeau 2021-02-18 12:34:32 +01:00
parent 5744c7b409
commit 30cafe81f0
2 changed files with 6 additions and 3 deletions

View File

@ -32,7 +32,7 @@ def check_links(d):
def create_rule(languages: str, user: Optional[str]):
'''Create a new rule.'''
token = os.environ.get('GITHUB_TOKEN')
url = build_github_repository_url(token)
url = build_github_repository_url(token, user)
config = {}
if user:
config['user.name'] = user

View File

@ -7,9 +7,12 @@ from contextlib import contextmanager
from rspec_tools.utils import copy_directory_content
def build_github_repository_url(token: str):
def build_github_repository_url(token: str, user: Optional[str]):
'Builds the rspec repository url'
return f'https://{token}@github.com/SonarSource/rspec.git'
if user:
return f'https://{user}:{token}@github.com/SonarSource/rspec.git'
else:
return f'https://{token}@github.com/SonarSource/rspec.git'
def extract_repository_name(url):
url_end = url.split('/')[-2:]