Merge pull request #33151 from ClickHouse/add_pretty_print

Debugging PR info
This commit is contained in:
alesapin 2021-12-24 21:47:20 +03:00 committed by GitHub
commit 20c0599751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,14 +44,14 @@ class PRInfo:
self.changed_files = set([]) self.changed_files = set([])
# workflow completed event, used for PRs only # workflow completed event, used for PRs only
if github_event['action'] == 'completed': if 'action' in github_event and github_event['action'] == 'completed':
self.sha = github_event['workflow_run']['head_sha'] self.sha = github_event['workflow_run']['head_sha']
prs_for_sha = requests.get(f"https://api.github.com/repos/{GITHUB_REPOSITORY}/commits/{self.sha}/pulls").json() prs_for_sha = requests.get(f"https://api.github.com/repos/{GITHUB_REPOSITORY}/commits/{self.sha}/pulls").json()
if len(prs_for_sha) != 0: if len(prs_for_sha) != 0:
github_event['pull_request'] = prs_for_sha[0] github_event['pull_request'] = prs_for_sha[0]
if 'pull_request' in github_event: # pull request and other similar events if 'pull_request' in github_event: # pull request and other similar events
self.number = github_event['number'] self.number = github_event['pull_request']['number']
if 'after' in github_event: if 'after' in github_event:
self.sha = github_event['after'] self.sha = github_event['after']
else: else: