Skip to content

Commit

Permalink
Updating actions to deploy json.
Browse files Browse the repository at this point in the history
  • Loading branch information
test committed Sep 25, 2023
1 parent 75880ba commit 7bca1b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
19 changes: 5 additions & 14 deletions .github/workflows/generate_json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,9 @@ jobs:
- name: Execute json_generator
run: python json_generator.py

- name: Commit json file
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add datasets.json
git commit -m "Generating new json file."
- name: Push changes to json branch
uses: ad-m/[email protected]

- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: json


folder: json # The folder the action should deploy.
branch: json
8 changes: 5 additions & 3 deletions json_generator.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import yaml, glob, json
import yaml, glob, json, os

if not os.path.isdir("./json"):
os.mkdir("json")

import glob
dataset = {"data": []}
for file in glob.glob("./datasets/*.yaml"):
with open(file, 'r') as yaml_file:
dataset['data'].append(yaml.safe_load(yaml_file))

with open('datasets.json', 'w') as file:
with open('./json/datasets.json', 'w') as file:
file.write(json.dumps(dataset, indent=2))

0 comments on commit 7bca1b8

Please sign in to comment.