Merge pull request #1637 from tannewt/tweak_file_updater

Update board info build to handle top level list.
This commit is contained in:
Dan Halbert 2019-03-11 22:15:42 -04:00 committed by GitHub
commit eec144d901
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 2 deletions

View File

@ -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 = ""