From b6b76b785575ae24e9df4d6556195974710defd5 Mon Sep 17 00:00:00 2001 From: Arash Date: Fri, 10 May 2024 15:25:26 +0200 Subject: [PATCH] fix some bugs --- github_run.py | 13 +++++++++++-- lib/plugins/bluesky.py | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/github_run.py b/github_run.py index 6ec635a..d58a628 100644 --- a/github_run.py +++ b/github_run.py @@ -16,7 +16,12 @@ def __init__(self): def comment(self, comment_text): print(comment_text) - if not comment_text or not self.github_token or not self.repo or not self.pr_number: + if ( + not comment_text + or not self.github_token + or not self.repo + or not self.pr_number + ): return headers = { "Accept": "application/vnd.github+json", @@ -26,7 +31,7 @@ def comment(self, comment_text): url = ( f"https://api.github.com/repos/{self.repo}/issues/{self.pr_number}/comments" ) - data = {"body": comment_text} + data = {"body": str(comment_text)} response = requests.post(url, headers=headers, json=data) if response.status_code == 201: return True @@ -46,6 +51,10 @@ def get_files(self): response = requests.get(raw_url) if response.status_code == 200: changed_file_path = file["filename"] + os.makedirs( + os.path.dirname(changed_file_path), + exist_ok=True, + ) with open(changed_file_path, "w") as f: f.write(response.text) diff --git a/lib/plugins/bluesky.py b/lib/plugins/bluesky.py index ed37392..13680ea 100644 --- a/lib/plugins/bluesky.py +++ b/lib/plugins/bluesky.py @@ -129,7 +129,7 @@ def handle_url_card( description = ( description_tag["content"] if description_tag - else description_tag_alt["content"] if description_tag_alt else None + else description_tag_alt["content"] if description_tag_alt else "" ) uri = url thumb = (