Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,34 @@ name: L.A. Districts Shapefile Workflow
on:
workflow_dispatch:
schedule:
- cron: "15 4 1 * *" # Monthly at 04:15 UTC to avoid high load
- cron: "15 4 1 * *" # Monthly at 04:15 UTC

permissions:
contents: read

jobs:
download_shapefiles:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.10.6'
python-version: "3.10"
cache: "pip"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Decode JSON configuration for token.json
pip install -r requirements.txt

- name: Decode service account JSON
run: echo "${{ secrets.ENCODED_JSON }}" | base64 --decode > ./drive_utils/token.json
env:
ENCODED_JSON: ${{ secrets.ENCODED_JSON }}

- name: Run main.py
run: python main.py
env:
FOLDER_ID: ${{ secrets.FOLDER_ID }}
DRIVE_FOLDER_ID: ${{ vars.DRIVE_FOLDER_ID }}
DRIVE_LOG_FOLDER_ID: ${{ vars.DRIVE_LOG_FOLDER_ID }}
9 changes: 6 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
OUTPUT_DIR = "shapefiles_output"
os.makedirs(OUTPUT_DIR, exist_ok=True)

# Google Drive Shared Folder ID
DRIVE_FOLDER_ID = "1vn4Jn41pyD6FlhNPncn3iBFW8gUFxcni"
DRIVE_LOG_FOLDER_ID = "1N6_3UC7y58QijWdSaBkF45zT6E1XBmQl"
# Google Drive Shared Folder IDs (from env)
DRIVE_FOLDER_ID = os.getenv("DRIVE_FOLDER_ID")
DRIVE_LOG_FOLDER_ID = os.getenv("DRIVE_LOG_FOLDER_ID")

if not DRIVE_FOLDER_ID or not DRIVE_LOG_FOLDER_ID:
raise RuntimeError("Missing required Google Drive folder IDs")

# District API endpoints (ArcGIS REST services)
API_URLS = {
Expand Down