Skip to content

Commit 65ca394

Browse files
Update update-resource-gallery.yaml (#392)
* 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 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent b3c1df0 commit 65ca394

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

.github/workflows/update-resource-gallery.yaml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
types:
66
- opened
77
- edited
8+
89
jobs:
910
validate-user-submission:
1011
if: |
@@ -87,21 +88,14 @@ jobs:
8788
- name: Update resource gallery
8889
shell: python
8990
run: |
91+
import yaml
9092
import json
91-
from ruamel.yaml import YAML
92-
93-
yaml = YAML()
94-
submission_file = 'resource-gallery-submission-input.json'
95-
resource_gallery_file = 'portal/resource_gallery.yaml'
96-
with open(submission_file) as f:
97-
data = json.load(f)
9893
99-
with open(resource_gallery_file) as f:
100-
resource_gallery = yaml.load(f)
94+
with open(submission_file, 'r') as file:
95+
data = json.load(file)
10196
102-
with open(resource_gallery_file, 'w') as f:
103-
resource_gallery.append(data)
104-
yaml.dump(resource_gallery, f)
97+
with open(resource_gallery_file, 'w') as yaml_file:
98+
yaml.dump(data, yaml_file)
10599
106100
- name: Run pre-commit hooks
107101
run: |

0 commit comments

Comments
 (0)