Skip to content

Commit 1eb91d5

Browse files
committed
updated main yml and py files and added secret and variable in actions
1 parent 7c0e537 commit 1eb91d5

2 files changed

Lines changed: 23 additions & 12 deletions

File tree

.github/workflows/main.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,34 @@ name: L.A. Districts Shapefile Workflow
33
on:
44
workflow_dispatch:
55
schedule:
6-
- cron: "15 4 1 * *" # Monthly at 04:15 UTC to avoid high load
6+
- cron: "15 4 1 * *" # Monthly at 04:15 UTC
7+
8+
permissions:
9+
contents: read
710

811
jobs:
912
download_shapefiles:
1013
runs-on: ubuntu-latest
1114
steps:
12-
- uses: actions/checkout@v2
15+
- name: Checkout repo
16+
uses: actions/checkout@v4
17+
1318
- name: Set up Python
14-
uses: actions/setup-python@v2
19+
uses: actions/setup-python@v5
1520
with:
16-
python-version: '3.10.6'
21+
python-version: "3.10"
22+
cache: "pip"
23+
1724
- name: Install dependencies
1825
run: |
1926
python -m pip install --upgrade pip
20-
pip install -r requirements.txt
21-
- name: Decode JSON configuration for token.json
27+
pip install -r requirements.txt
28+
29+
- name: Decode service account JSON
2230
run: echo "${{ secrets.ENCODED_JSON }}" | base64 --decode > ./drive_utils/token.json
23-
env:
24-
ENCODED_JSON: ${{ secrets.ENCODED_JSON }}
31+
2532
- name: Run main.py
2633
run: python main.py
2734
env:
28-
FOLDER_ID: ${{ secrets.FOLDER_ID }}
35+
DRIVE_FOLDER_ID: ${{ vars.DRIVE_FOLDER_ID }}
36+
DRIVE_LOG_FOLDER_ID: ${{ vars.DRIVE_LOG_FOLDER_ID }}

main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@
2222
OUTPUT_DIR = "shapefiles_output"
2323
os.makedirs(OUTPUT_DIR, exist_ok=True)
2424

25-
# Google Drive Shared Folder ID
26-
DRIVE_FOLDER_ID = "1vn4Jn41pyD6FlhNPncn3iBFW8gUFxcni"
27-
DRIVE_LOG_FOLDER_ID = "1N6_3UC7y58QijWdSaBkF45zT6E1XBmQl"
25+
# Google Drive Shared Folder IDs (from env)
26+
DRIVE_FOLDER_ID = os.getenv("DRIVE_FOLDER_ID")
27+
DRIVE_LOG_FOLDER_ID = os.getenv("DRIVE_LOG_FOLDER_ID")
28+
29+
if not DRIVE_FOLDER_ID or not DRIVE_LOG_FOLDER_ID:
30+
raise RuntimeError("Missing required Google Drive folder IDs")
2831

2932
# District API endpoints (ArcGIS REST services)
3033
API_URLS = {

0 commit comments

Comments
 (0)