mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-23 06:16:43 +00:00
refactor: get_issue_url() returns *just* the URL
Leave the extra text to the caller (main)
This commit is contained in:
parent
b9c9d197ff
commit
1674ad54d4
@ -352,4 +352,4 @@ class GitHubClient(object):
|
|||||||
return pr_request.status_code
|
return pr_request.status_code
|
||||||
|
|
||||||
def get_issue_url(self, new_issue_number):
|
def get_issue_url(self, new_issue_number):
|
||||||
return f'Issue URL: {self.line_base_url}{self.repo}/issues/{new_issue_number}'
|
return f'{self.line_base_url}{self.repo}/issues/{new_issue_number}'
|
||||||
|
|||||||
2
main.py
2
main.py
@ -101,7 +101,7 @@ if __name__ == "__main__":
|
|||||||
# Duplicate the line to retain the comment syntax.
|
# Duplicate the line to retain the comment syntax.
|
||||||
new_line = file_lines[line_number]
|
new_line = file_lines[line_number]
|
||||||
remove = fr'{raw_issue.identifier}.*{raw_issue.title}'
|
remove = fr'{raw_issue.identifier}.*{raw_issue.title}'
|
||||||
insert = client.get_issue_url(new_issue_number)
|
insert = f'Issue URL: {client.get_issue_url(new_issue_number)}'
|
||||||
new_line = re.sub(remove, insert, new_line)
|
new_line = re.sub(remove, insert, new_line)
|
||||||
# Check if the URL line already exists, if so abort.
|
# Check if the URL line already exists, if so abort.
|
||||||
if line_number == len(file_lines) - 1 or file_lines[line_number + 1] != new_line:
|
if line_number == len(file_lines) - 1 or file_lines[line_number + 1] != new_line:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user