From 844b2d92e444a7484195d11e9049fccc3de0e5a2 Mon Sep 17 00:00:00 2001 From: Orhan Eroglu <32553057+erogluorhan@users.noreply.github.com> Date: Thu, 18 Jan 2024 12:08:50 -0700 Subject: [PATCH 1/5] Update update-resource-gallery.yaml Correct the fact that json file data being dumped into yaml file with incorrect format --- .../workflows/update-resource-gallery.yaml | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/update-resource-gallery.yaml b/.github/workflows/update-resource-gallery.yaml index 5b5a0e25..6baf2890 100644 --- a/.github/workflows/update-resource-gallery.yaml +++ b/.github/workflows/update-resource-gallery.yaml @@ -87,21 +87,14 @@ jobs: - name: Update resource gallery shell: python run: | + import yaml import json - from ruamel.yaml import YAML - - yaml = YAML() - submission_file = 'resource-gallery-submission-input.json' - resource_gallery_file = 'portal/resource_gallery.yaml' - with open(submission_file) as f: - data = json.load(f) - - with open(resource_gallery_file) as f: - resource_gallery = yaml.load(f) - - with open(resource_gallery_file, 'w') as f: - resource_gallery.append(data) - yaml.dump(resource_gallery, f) + + with open(submission_file, 'r') as file: + data = json.load(file) + + with open(resource_gallery_file, 'w') as yaml_file: + yaml.dump(data, yaml_file) - name: Run pre-commit hooks run: | From 12dc2ee426bbcbe703ddf641a45cc23ae20a9923 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:10:14 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/update-resource-gallery.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-resource-gallery.yaml b/.github/workflows/update-resource-gallery.yaml index 6baf2890..be91f297 100644 --- a/.github/workflows/update-resource-gallery.yaml +++ b/.github/workflows/update-resource-gallery.yaml @@ -89,10 +89,10 @@ jobs: run: | import yaml import json - + with open(submission_file, 'r') as file: data = json.load(file) - + with open(resource_gallery_file, 'w') as yaml_file: yaml.dump(data, yaml_file) From 02113fffded0ed6235145a70f7d0f3c5fcbdf030 Mon Sep 17 00:00:00 2001 From: Orhan Eroglu <32553057+erogluorhan@users.noreply.github.com> Date: Thu, 18 Jan 2024 14:35:54 -0700 Subject: [PATCH 3/5] Simple line break added --- .github/workflows/update-resource-gallery.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-resource-gallery.yaml b/.github/workflows/update-resource-gallery.yaml index be91f297..16560490 100644 --- a/.github/workflows/update-resource-gallery.yaml +++ b/.github/workflows/update-resource-gallery.yaml @@ -5,6 +5,7 @@ on: types: - opened - edited + jobs: validate-user-submission: if: | From c5cd227ea31053772451240f194e59eeba0ddd6a Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Wed, 4 Dec 2024 11:47:24 -0500 Subject: [PATCH 4/5] don't overwrite yaml data --- .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 16560490..5dda3d8c 100644 --- a/.github/workflows/update-resource-gallery.yaml +++ b/.github/workflows/update-resource-gallery.yaml @@ -92,10 +92,15 @@ jobs: import json 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: | From 09016e930bd7c3da2648e5ba77e5bf657a112437 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:50:43 +0000 Subject: [PATCH 5/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/update-resource-gallery.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-resource-gallery.yaml b/.github/workflows/update-resource-gallery.yaml index 39af3084..2351c2ca 100644 --- a/.github/workflows/update-resource-gallery.yaml +++ b/.github/workflows/update-resource-gallery.yaml @@ -93,15 +93,15 @@ jobs: submission_file = 'resource-gallery-submission-input.json' resource_gallery_file = 'portal/resource_gallery.yaml' - + with open(submission_file, 'r') as 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(existing_data, yaml_file, default_flow_style=False)