mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-22 22:06:43 +00:00
Add diff url for first branch commit
This commit is contained in:
parent
0db9bdffa1
commit
30f81ca3e0
6
main.py
6
main.py
@ -63,7 +63,11 @@ class GitHubClient(object):
|
||||
|
||||
def get_last_diff(self):
|
||||
"""Get the last diff based on the SHA of the last two commits."""
|
||||
diff_url = f'{self.repos_url}{self.repo}/compare/{self.before}...{self.sha}'
|
||||
if not self.before or self.before.startswith('000000'):
|
||||
# Last commit SHA is empty which means this is the first commit of the branch
|
||||
diff_url = f'{self.repos_url}{self.repo}/commits/{self.sha}'
|
||||
else:
|
||||
diff_url = f'{self.repos_url}{self.repo}/compare/{self.before}...{self.sha}'
|
||||
diff_headers = {
|
||||
'Accept': 'application/vnd.github.v3.diff',
|
||||
'Authorization': f'token {self.token}'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user