8000 Merge pull request #1637 from tannewt/tweak_file_updater · tannewt/circuitpython@eec144d · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit eec144d

Browse files
authored
Merge pull request micropython#1637 from tannewt/tweak_file_updater
Update board info build to handle top level list.
2 parents e3e35a5 + cac9da3 commit eec144d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tools/build_board_info.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff 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

101105
def 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 = ""

0 commit comments

Comments
 (0)
0