Skip to content

Commit

Permalink
Fix diff URL for PRs
Browse files Browse the repository at this point in the history
Fixes #231
  • Loading branch information
alstr committed Dec 12, 2024
1 parent f357c40 commit 4547157
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions GitHubClient.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import requests
import json
import re
from Client import Client

class GitHubClient(Client):
Expand Down Expand Up @@ -65,6 +66,11 @@ def get_last_diff(self):
if self.diff_url:
# Diff url was directly passed in config, likely due to this being a PR.
diff_url = self.diff_url
pr_url_pattern = r'/pull/(\d+)\.diff$'
pr_search = re.search(pr_url_pattern, diff_url)
if pr_search:
pr_number = pr_search.group(1)
diff_url = f'self.repos_url{self.repo}/pulls/{pr_number}'
elif self.before != '0000000000000000000000000000000000000000':
# 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}'
Expand Down

0 comments on commit 4547157

Please sign in to comment.