Skip to content
Snippets Groups Projects
Commit 03c51e9c authored by Albin Heimerson's avatar Albin Heimerson
Browse files

Add check for to_canvas folder, skip if not there

parent 77854908
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ API_URL = "https://canvas.education.lu.se/" ...@@ -14,6 +14,7 @@ API_URL = "https://canvas.education.lu.se/"
API_TOKEN = os.environ["CANVAS_TOKEN"] API_TOKEN = os.environ["CANVAS_TOKEN"]
CANVAS_COURSE_CODE = os.environ["CANVAS_COURSE_CODE"] CANVAS_COURSE_CODE = os.environ["CANVAS_COURSE_CODE"]
if os.path.isdir(GITLAB_FOLDER_NAME):
canvas = Canvas(API_URL, API_TOKEN) canvas = Canvas(API_URL, API_TOKEN)
course = canvas.get_course(CANVAS_COURSE_CODE) course = canvas.get_course(CANVAS_COURSE_CODE)
...@@ -48,3 +49,5 @@ while len(folders) > 0: ...@@ -48,3 +49,5 @@ while len(folders) > 0:
else: else:
print("{} is a file, uploading!".format(gitlabpath)) print("{} is a file, uploading!".format(gitlabpath))
folder.upload(gitlabpath) folder.upload(gitlabpath)
else:
print("to_canvas directory not found in current repository, skipping sync")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment