File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,13 +96,25 @@ def get_current_info():
9696 response = response .json ()
9797
9898 git_info = commit_sha , response ["sha" ]
99- return git_info , json .loads (base64 .b64decode (response ["content" ]).decode ("utf-8" ))
99+ current_list = json .loads (base64 .b64decode (response ["content" ]).decode ("utf-8" ))
100+ current_info = {}
101+ for info in current_list :
102+ current_info [info ["id" ]] = info
103+ return git_info , current_info
100104
101105def create_pr (changes , updated , git_info ):
102106 commit_sha , original_blob_sha = git_info
103107 branch_name = "new_release_" + changes ["new_release" ]
104108
105- updated = json .dumps (updated , sort_keys = True , indent = 4 ).encode ("utf-8" ) + b"\n "
109+ # Convert the dictionary to a list of boards. Liquid templates only handle arrays.
110+ updated_list = []
111+ all_ids = sorted (updated .keys ())
112+ for id in all_ids :
113+ info = updated [id ]
114+ info ["id" ] = id
115+ updated_list .append (info )
116+
117+ updated = json .dumps (updated_list , sort_keys = True , indent = 4 ).encode ("utf-8" ) + b"\n "
106118 print (updated .decode ("utf-8" ))
107119 pr_title = "Automated website update for release {}" .format (changes ["new_release" ])
108120 boards = ""
You can’t perform that action at this time.
0 commit comments