Skip to content

Commit

Permalink
fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
arash77 committed May 10, 2024
1 parent 7b37bc3 commit b6b76b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions github_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down

0 comments on commit b6b76b7

Please sign in to comment.