Update DeltaDTM to v1.1 #715
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: gee_catalog | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo content | |
uses: actions/checkout@v2 # checkout the repository content to github runner | |
- name: setup python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.8" # install the python version needed | |
- name: upgrade pip and install python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U pip setuptools | |
pip install requests | |
- name: json2csv | |
uses: jannekem/run-python-script-action@v1 | |
with: | |
script: | | |
import csv | |
import json | |
with open('community_datasets.json',encoding='utf-8') as f: | |
data = json.load(f) | |
jsonl_file = 'community_datasets.jsonl' | |
with open(jsonl_file, 'w') as f: | |
for entry in data: | |
json.dump(entry, f) | |
f.write('\n') # Write each JSON object on a new line | |
with open('community_datasets.csv','w') as csvfile: | |
writer=csv.DictWriter(csvfile,fieldnames=["id", "provider", "title", "type","tags","sample_code","license","license_text","docs_page","thematic_group","thumbnail"], delimiter=',',lineterminator='\n') | |
writer.writeheader() | |
for datasets in data: | |
gee_id = datasets['id'] | |
gee_provider = datasets['provider'] | |
gee_title = datasets['title'] | |
gee_type = datasets['type'] | |
gee_tags = datasets['tags'] | |
sample_code = datasets['sample_code'] | |
license = datasets['license'] | |
docs_page = datasets['docs'] | |
thematic_group = datasets['thematic_group'] | |
thumbnail = datasets['thumbnail'] | |
if license == "custom": | |
license_text = datasets['license_text'] | |
else: | |
license_text = "NA" | |
with open('community_datasets.csv','a') as csvfile: | |
writer=csv.writer(csvfile,delimiter=',',lineterminator='\n') | |
writer.writerow([gee_id,gee_provider,gee_title,gee_type,gee_tags,sample_code,license,license_text,docs_page,thematic_group,thumbnail]) | |
csvfile.close() | |
- name: commit files | |
continue-on-error: true | |
run: | | |
today=$(date +"%Y-%m-%d") | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add -A | |
git commit -m "updated datasets ${today} UTC" -a | |
- name: push changes | |
continue-on-error: true | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: master |