From 3729e1ab970a903d9bf49e1ed5ff3441ef5cf17c Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:19:39 -0500 Subject: [PATCH] Update resource gallery (#468) * Update update-resource-gallery.yaml Correct the fact that json file data being dumped into yaml file with incorrect format * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Simple line break added * don't overwrite yaml data * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Orhan Eroglu <32553057+erogluorhan@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/update-resource-gallery.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-resource-gallery.yaml b/.github/workflows/update-resource-gallery.yaml index ab1e9371..2351c2ca 100644 --- a/.github/workflows/update-resource-gallery.yaml +++ b/.github/workflows/update-resource-gallery.yaml @@ -95,10 +95,15 @@ jobs: resource_gallery_file = 'portal/resource_gallery.yaml' with open(submission_file, 'r') as file: - data = json.load(file) + new_data = json.load(file) + + with open(resource_gallery_file, 'r') as yaml_file: + existing_data = yaml.load(yaml_file) or [] + + existing_data.append(new_data) with open(resource_gallery_file, 'w') as yaml_file: - yaml.dump(data, yaml_file) + yaml.dump(existing_data, yaml_file, default_flow_style=False) - name: Run pre-commit hooks run: |