Skip to content
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
10 changes: 8 additions & 2 deletions contribute.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import github
from github import Github
import os,sys,platform,base64
import os,sys,platform,base64,time

# Intializing the Variables
# Hashed token
Expand Down Expand Up @@ -85,6 +85,7 @@ def printPRStatus(upstream_repo):
max_num = max(max_num,i.number)
for i in pulls:
max_num = max(max_num,i.number)
time.sleep(4)
print(f'Check your example here https://github.com/{UPSTREAM_ACCOUNT}/{REPO_NAME}/pulls/{max_num+1}',end="")
except Exception as e:
print("Your example successfully uploaded but unable to fetch status.Please try again")
Expand All @@ -94,6 +95,11 @@ def isImageFile(filename):
image_extensions = ['.jpeg', '.jpg', '.png','.gif']
return any(filename.endswith(ext) for ext in image_extensions)

def remove_prefix(text, prefix):
if text.startswith(prefix):
return text[len(prefix):]
return text


# Decode Github Token
def decode_token(encoded_token):
Expand Down Expand Up @@ -154,7 +160,7 @@ def decode_token(encoded_token):
else:
with open(path, 'r') as file:
content = file.read()
file_path = f'{DIR_PATH+path.removeprefix(STUDY_NAME_PATH)}'
file_path = f'{DIR_PATH+remove_prefix(path,STUDY_NAME_PATH)}'
if(platform.uname()[0]=='Windows'): file_path=file_path.replace("\\","/")
appendBlobInTree(repo,content,file_path,tree_content)
commitAndUpdateRef(repo,tree_content,base_ref.commit,branch)
Expand Down