mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-22 22:06:43 +00:00
Update diff_url logic in GitHubClient.py to simplify commit comparison handling. Adjusted the URL for single commit cases and removed unnecessary comparisons against an empty tree.
Signed-off-by: Shakar Bakr <5h4k4r.b4kr@gmail.com>
This commit is contained in:
parent
5cdfff250b
commit
61dcc147f4
@ -89,15 +89,14 @@ class GitHubClient(Client):
|
|||||||
# There is a valid before SHA to compare with, or this is a release being created.
|
# There is a valid before SHA to compare with, or this is a release being created.
|
||||||
diff_url = f'{self.repos_url}{self.repo}/compare/{self.before}...{self.sha}'
|
diff_url = f'{self.repos_url}{self.repo}/compare/{self.before}...{self.sha}'
|
||||||
elif len(self.commits) == 1:
|
elif len(self.commits) == 1:
|
||||||
# There is only one commit - compare against empty tree to get all files
|
# There is only one commit.
|
||||||
diff_url = f'{self.repos_url}{self.repo}/compare/4b825dc642cb6eb9a060e54bf8d69288fbee4904...{self.sha}'
|
diff_url = f'{self.repos_url}{self.repo}/commits/{self.sha}'
|
||||||
elif len(self.commits) > 1:
|
elif len(self.commits) > 1:
|
||||||
# There are several commits: compare with the oldest one.
|
# There are several commits: compare with the oldest one.
|
||||||
oldest = sorted(self.commits, key=self._get_timestamp)[0]['id']
|
oldest = sorted(self.commits, key=self._get_timestamp)[0]['id']
|
||||||
diff_url = f'{self.repos_url}{self.repo}/compare/{oldest}...{self.sha}'
|
diff_url = f'{self.repos_url}{self.repo}/compare/{oldest}...{self.sha}'
|
||||||
else:
|
else:
|
||||||
# No commits info available, compare against empty tree to get all files
|
return None
|
||||||
diff_url = f'{self.repos_url}{self.repo}/compare/4b825dc642cb6eb9a060e54bf8d69288fbee4904...{self.sha}'
|
|
||||||
|
|
||||||
diff_headers = {
|
diff_headers = {
|
||||||
'Accept': 'application/vnd.github.v3.diff',
|
'Accept': 'application/vnd.github.v3.diff',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user