Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix file not found error for get_preview script #381

Merged
merged 2 commits into from
Jan 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions backend/utils/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ def get_file(download_url: str, file: str, branch: str = 'HEAD') -> [dict, None]
local_workspace = os.getenv("GITHUB_WORKSPACE")
if local_workspace:
# read files locally since github action already checked it out
with open(os.path.join(local_workspace, file)) as f:
return f.read()
if os.path.exists(os.path.join(local_workspace, file)):
with open(os.path.join(local_workspace, file)) as f:
codemonkey800 marked this conversation as resolved.
Show resolved Hide resolved
return f.read()
else:
return None

api_url = download_url.replace("https://github.com/",
"https://raw.githubusercontent.com/")
Expand Down