@@ -198,9 +198,6 @@ def make_github_operations(
198
198
logger .error (error )
199
199
continue
200
200
201
- commit_message = make_commit_message (repo , fork )
202
- pull_request_body = make_pull_request_body (repo , fork )
203
-
204
201
try :
205
202
fork .create_git_ref (
206
203
ref = "refs/heads/" + new_branch_name ,
@@ -236,8 +233,11 @@ def make_github_operations(
236
233
else :
237
234
logger .info (msg )
238
235
236
+ commit_message = make_commit_message (repo , fork , old_content )
237
+ pull_request_body = make_pull_request_body (repo , fork , old_content )
238
+
239
239
# Transform the content
240
- content = transform_file_content (old_content )
240
+ content = transform_file_content (repo , fork , old_content )
241
241
242
242
# Update file content
243
243
if old_content :
@@ -298,7 +298,7 @@ def make_github_operations(
298
298
"workflows" ,
299
299
"pin_downstream.yml" ,
300
300
)
301
- .read_text ()
301
+ .read_bytes ()
302
302
)
303
303
304
304
@@ -309,13 +309,19 @@ async def main(repos, file_name):
309
309
token ,
310
310
repo_urls ,
311
311
new_branch_name ,
312
- lambda _upstream , fork : commit_message ,
313
- lambda _upstream , fork : pull_request_body .replace (
314
- "REPO_ORG/REPO_NAME" , fork .full_name
312
+ lambda _upstream , _fork , _old_content : commit_message ,
313
+ lambda _upstream , fork , _old_content : pull_request_body .replace (
314
+ "REPO_ORG/REPO_NAME" ,
315
+ fork .full_name ,
316
+ ),
317
+ lambda upstream , _fork , old_content : (
318
+ old_content if old_content is not None else file_content
319
+ )
320
+ .decode ()
321
+ .replace (
322
+ "- master" ,
323
+ f"- { upstream .default_branch } " ,
315
324
),
316
- lambda content : content .upper ()
317
- if content is not None
318
- else file_content ,
319
325
fail_on_not_present = False ,
320
326
)
321
327
return
0 commit comments