diff --git a/.github/workflows/generate-data-member.yml b/.github/workflows/generate-data-member.yml new file mode 100644 index 00000000..e9cfd733 --- /dev/null +++ b/.github/workflows/generate-data-member.yml @@ -0,0 +1,24 @@ +name: Generate Data Member in Json +on: + push: + branches: [master] + workflow_dispatch: + +jobs: + generate_data_member: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Download csv file of member form in gsheet + run: | + curl -L -o ./scripts/dataMember.csv https://docs.google.com/spreadsheets/d/1SaXnuRt-1KXyDGS18KqU7cus4_IWNxpGhiVy0J1vz-U/export?format=csv + - name: run python script to convert csv to json + run: | + cd ./scripts + python script.py + git checkout -b production + cp ./dataMember.json ../data/dataMember.json + cd .. + rm ./scripts + + diff --git a/scripts/script.py b/scripts/script.py new file mode 100644 index 00000000..01f3e35f --- /dev/null +++ b/scripts/script.py @@ -0,0 +1,21 @@ +import csv +import json + +def csv_to_json(csv_file, json_file): + # Read CSV data and convert it to a list of dictionaries + with open(csv_file, 'r') as csvfile: + reader = csv.DictReader(csvfile) + data = [row for row in reader] + + # Write the data to a JSON file + with open(json_file, 'w') as jsonfile: + json.dump(data, jsonfile, indent=4) + +if __name__ == "__main__": + # Replace 'input.csv' with the path of your CSV file + csv_file_path = 'dataMember.csv' + + # Replace 'output.json' with the desired path for the JSON output file + json_file_path = 'dataMember.json' + + csv_to_json(csv_file_path, json_file_path)