diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2019-03-11 17:07:15 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2019-03-11 17:07:15 -0700 |
| commit | cac9da37f9d48eb7c1f49c2f0bf4cabd7845598e (patch) | |
| tree | a35b389f9f00a6a8993d9dc66444644e8d4dbb6f /tools | |
| parent | e3e35a504894d27e804c8973e18551f844ef087a (diff) | |
Update board info build to handle top level list.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/build_board_info.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/build_board_info.py b/tools/build_board_info.py index e40b990bd..b09b29eff 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -96,13 +96,25 @@ def get_current_info(): response = response.json() git_info = commit_sha, response["sha"] - return git_info, json.loads(base64.b64decode(response["content"]).decode("utf-8")) + current_list = json.loads(base64.b64decode(response["content"]).decode("utf-8")) + current_info = {} + for info in current_list: + current_info[info["id"]] = info + return git_info, current_info def create_pr(changes, updated, git_info): commit_sha, original_blob_sha = git_info branch_name = "new_release_" + changes["new_release"] - updated = json.dumps(updated, sort_keys=True, indent=4).encode("utf-8") + b"\n" + # Convert the dictionary to a list of boards. Liquid templates only handle arrays. + updated_list = [] + all_ids = sorted(updated.keys()) + for id in all_ids: + info = updated[id] + info["id"] = id + updated_list.append(info) + + updated = json.dumps(updated_list, sort_keys=True, indent=4).encode("utf-8") + b"\n" print(updated.decode("utf-8")) pr_title = "Automated website update for release {}".format(changes["new_release"]) boards = "" |
