Skip to content

Commit 2ac3e87

Browse files
authored
Merge pull request #103 from parteekcoder/contribute_action
Update contribute.py
2 parents c97416f + 438d328 commit 2ac3e87

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

contribute.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def commitAndUpdateRef(repo,tree_content,commit,branch):
5959

6060

6161
def appendBlobInTree(repo,content,file_path,tree_content):
62-
blob = repo.create_git_blob(content,'utf-8')
62+
blob = repo.create_git_blob(content,'ascii')
6363
tree_content.append( github.InputGitTreeElement(path=file_path,mode="100644",type="blob",sha=blob.sha))
6464

6565

@@ -106,7 +106,6 @@ def decode_token(encoded_token):
106106
decoded_bytes = encoded_token.encode("ascii")
107107
convertedbytes = base64.b64decode(decoded_bytes)
108108
decoded_token = convertedbytes.decode("ascii")
109-
print('token decoded successfully')
110109
return decoded_token
111110

112111

@@ -155,23 +154,20 @@ def decode_token(encoded_token):
155154
for root, dirs, files in os.walk(STUDY_NAME_PATH):
156155
for filename in files:
157156
path = f"{root}/{filename}"
157+
print(path)
158158
if isImageFile(filename):
159-
with open(path, 'rb') as file:
159+
with open(file=path, mode='rb') as file:
160160
image = file.read()
161-
print('image processing')
162161
content = base64.b64encode(image).decode('utf-8')
163162
else:
164-
with open(path, 'r') as file:
163+
with open(file=path, mode='r',encoding='ascii') as file:
165164
content = file.read()
166165
file_path = f'{DIR_PATH+remove_prefix(path,STUDY_NAME_PATH)}'
167166
if(platform.uname()[0]=='Windows'): file_path=file_path.replace("\\","/")
168-
print(path)
167+
print('d',end="")
169168
appendBlobInTree(repo,content,file_path,tree_content)
170-
print('append comp')
171169
commitAndUpdateRef(repo,tree_content,base_ref.commit,branch)
172-
print('comit comp')
173170
runWorkflow(repo,upstream_repo)
174-
print('work comp')
175171
except Exception as e:
176172
print(e)
177173
print("Some error Occured.Please try again after some time.",end="")

0 commit comments

Comments
 (0)