Skip to content

Commit

Permalink
Fix file not found error for get_preview script (#381)
Browse files Browse the repository at this point in the history
* Fix file not found error for get_preview script
  • Loading branch information
codemonkey800 authored Jan 7, 2022
1 parent e2ee13d commit a842ea4
Showing 1 changed file with 5 additions and 2 deletions.
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:
return f.read()
else:
return None

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

0 comments on commit a842ea4

Please sign in to comment.