Skip to content

Commit

Permalink
Add process-json workflow
Browse files Browse the repository at this point in the history
Signed-off-by: joyakis <[email protected]>
  • Loading branch information
Joyakis committed Apr 3, 2023
1 parent 96f6c0e commit 05cd351
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/process-json-file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: process-json-file

on:
# Run the workflow every day at 6:00am UTC
schedule:
- cron: "0 6 * * *"

jobs:
process-json:
runs-on: ubuntu-latest

steps:
# Checkout the code from the repository
- name: Checkout code
uses: actions/checkout@v2

# Install Python
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

# Install dependencies
- name: Install dependencies
run: pip install -r requirements.txt

# Run the Python script to process the JSON file
- name: Process JSON file
run: python data.py

# Commit changes to the repository
- name: Commit changes
run: |
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git add processed_data.json
git commit -m "Process data"
# Push changes to the remote repository
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
geopandas
matplotlib
pandas
19 changes: 19 additions & 0 deletions Data/data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import json

# Read in the JSON data
with open('KEN_AL2_Kenya_GEZ.json', 'r') as f:
data = json.load(f)

# Process the data
processed_data = []
for item in data:
# Perform some transformation on the data
processed_item = {
'name': item['name'],
'age': item['gez_code'] * 2
}
processed_data.append(processed_item)

# Write the processed data to a new JSON file
with open('processed_data.json', 'w') as f:
json.dump(processed_data, f)

0 comments on commit 05cd351

Please sign in to comment.