Merge pull request #63331 from ClickHouse/fix-commit-html-url

The commit url has different pattern
This commit is contained in:
Mikhail f. Shiryaev 2024-05-03 12:38:24 +00:00 committed by GitHub
commit 88f3c27953
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -158,7 +158,7 @@ class PRInfo:
else: else:
self.sha = github_event["pull_request"]["head"]["sha"] self.sha = github_event["pull_request"]["head"]["sha"]
self.commit_html_url = f"{repo_prefix}/commits/{self.sha}" self.commit_html_url = f"{repo_prefix}/commit/{self.sha}"
self.pr_html_url = f"{repo_prefix}/pull/{self.number}" self.pr_html_url = f"{repo_prefix}/pull/{self.number}"
# master or backport/xx.x/xxxxx - where the PR will be merged # master or backport/xx.x/xxxxx - where the PR will be merged
@ -213,7 +213,7 @@ class PRInfo:
.replace("{base}", base_sha) .replace("{base}", base_sha)
.replace("{head}", self.sha) .replace("{head}", self.sha)
) )
self.commit_html_url = f"{repo_prefix}/commits/{self.sha}" self.commit_html_url = f"{repo_prefix}/commit/{self.sha}"
elif "commits" in github_event: elif "commits" in github_event:
self.event_type = EventType.PUSH self.event_type = EventType.PUSH
@ -227,7 +227,7 @@ class PRInfo:
logging.error("Failed to convert %s to integer", merged_pr) logging.error("Failed to convert %s to integer", merged_pr)
self.sha = github_event["after"] self.sha = github_event["after"]
pull_request = get_pr_for_commit(self.sha, github_event["ref"]) pull_request = get_pr_for_commit(self.sha, github_event["ref"])
self.commit_html_url = f"{repo_prefix}/commits/{self.sha}" self.commit_html_url = f"{repo_prefix}/commit/{self.sha}"
if pull_request is None or pull_request["state"] == "closed": if pull_request is None or pull_request["state"] == "closed":
# it's merged PR to master # it's merged PR to master
@ -296,7 +296,7 @@ class PRInfo:
"GITHUB_SHA", "0000000000000000000000000000000000000000" "GITHUB_SHA", "0000000000000000000000000000000000000000"
) )
self.number = 0 self.number = 0
self.commit_html_url = f"{repo_prefix}/commits/{self.sha}" self.commit_html_url = f"{repo_prefix}/commit/{self.sha}"
self.pr_html_url = f"{repo_prefix}/commits/{ref}" self.pr_html_url = f"{repo_prefix}/commits/{ref}"
self.base_ref = ref self.base_ref = ref
self.base_name = self.repo_full_name self.base_name = self.repo_full_name