Fix Gitea seed recovery and workflow guards
This commit is contained in:
@@ -43,11 +43,58 @@ jobs:
|
||||
fi
|
||||
git fetch origin main --depth=1
|
||||
git reset --hard FETCH_HEAD
|
||||
if [ ! -f GatherTradingData.json ]; then
|
||||
echo "::error::GatherTradingData.json 없음 — canonical seed snapshot이 필요합니다."
|
||||
|
||||
- name: Prepare Raw Seed Snapshot
|
||||
run: |
|
||||
if [ -f GatherTradingData.json ]; then
|
||||
echo "GatherTradingData.json present"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f GatherTradingData.xlsx ]; then
|
||||
echo "GatherTradingData.json missing; regenerating from GatherTradingData.xlsx"
|
||||
python3 tools/convert_xlsx_to_json.py \
|
||||
--xlsx GatherTradingData.xlsx \
|
||||
--out GatherTradingData.json
|
||||
if [ -f GatherTradingData.json ]; then
|
||||
echo "GatherTradingData.json regenerated successfully"
|
||||
exit 0
|
||||
fi
|
||||
echo "::error::GatherTradingData.xlsx is present but JSON regeneration failed."
|
||||
echo "::error::Check tools/convert_xlsx_to_json.py and workbook sheet integrity."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f .clasprc.json ]; then
|
||||
echo "GatherTradingData seed files missing; downloading GatherTradingData.xlsx from Google Drive via .clasprc.json"
|
||||
python3 tools/download_trading_data.py
|
||||
if [ -f GatherTradingData.xlsx ]; then
|
||||
echo "GatherTradingData.xlsx downloaded successfully; regenerating GatherTradingData.json"
|
||||
python3 tools/convert_xlsx_to_json.py \
|
||||
--xlsx GatherTradingData.xlsx \
|
||||
--out GatherTradingData.json
|
||||
if [ -f GatherTradingData.json ]; then
|
||||
echo "GatherTradingData.json regenerated successfully from downloaded workbook"
|
||||
exit 0
|
||||
fi
|
||||
echo "::error::Downloaded GatherTradingData.xlsx but JSON regeneration failed."
|
||||
echo "::error::Check workbook integrity and tools/convert_xlsx_to_json.py."
|
||||
exit 1
|
||||
fi
|
||||
echo "::error::.clasprc.json exists but GatherTradingData.xlsx was not downloaded."
|
||||
echo "::error::Check Google Drive access and tools/download_trading_data.py."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "::error::Neither GatherTradingData.json nor GatherTradingData.xlsx exists in the checked-out tree."
|
||||
echo "::error::This workflow requires a canonical seed snapshot before KIS collection can start."
|
||||
echo "::error::Fix options:"
|
||||
echo "::error:: 1) Commit GatherTradingData.json to the repository tree."
|
||||
echo "::error:: 2) Commit GatherTradingData.xlsx so the workflow can regenerate the JSON."
|
||||
echo "::error:: 3) Provide .clasprc.json so the workflow can download GatherTradingData.xlsx from Google Drive and regenerate the JSON."
|
||||
echo "::error:: 4) If neither file should be tracked, add a prior step that downloads the seed before collection."
|
||||
exit 1
|
||||
|
||||
- name: Configure Runtime Paths
|
||||
run: |
|
||||
export PATH=/usr/local/bin:$PATH
|
||||
@@ -79,18 +126,36 @@ jobs:
|
||||
|
||||
- name: "[CRITICAL] Validate KIS API Credentials (mock)"
|
||||
env:
|
||||
KIS_APP_Key_TEST: ${{ secrets.KIS_APP_KEY_TEST }}
|
||||
KIS_APP_Secret_TEST: ${{ secrets.KIS_APP_SECRET_TEST }}
|
||||
# Gitea repository variables are injected here; the Python loader reads these env names.
|
||||
KIS_APP_Key_TEST: ${{ vars.KIS_APP_KEY_TEST }}
|
||||
KIS_APP_Secret_TEST: ${{ vars.KIS_APP_SECRET_TEST }}
|
||||
run: |
|
||||
if [ -z "${KIS_APP_Key_TEST:-}" ]; then
|
||||
echo "::error::Gitea variable KIS_APP_KEY_TEST is missing or empty"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${KIS_APP_Secret_TEST:-}" ]; then
|
||||
echo "::error::Gitea variable KIS_APP_SECRET_TEST is missing or empty"
|
||||
exit 1
|
||||
fi
|
||||
python3 tools/validate_kis_api_credentials_v1.py \
|
||||
--account mock \
|
||||
--ticker 005930
|
||||
|
||||
- name: Collect KIS Market Data to SQLite (read-only)
|
||||
env:
|
||||
KIS_APP_Key: ${{ secrets.KIS_APP_KEY }}
|
||||
KIS_APP_Secret: ${{ secrets.KIS_APP_SECRET }}
|
||||
# Real collection uses repository variables, not Windows shell env syntax.
|
||||
KIS_APP_Key: ${{ vars.KIS_APP_KEY }}
|
||||
KIS_APP_Secret: ${{ vars.KIS_APP_SECRET }}
|
||||
run: |
|
||||
if [ -z "${KIS_APP_Key:-}" ]; then
|
||||
echo "::error::Gitea variable KIS_APP_KEY is missing or empty"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${KIS_APP_Secret:-}" ]; then
|
||||
echo "::error::Gitea variable KIS_APP_SECRET is missing or empty"
|
||||
exit 1
|
||||
fi
|
||||
python3 tools/run_kis_data_collection_v1.py \
|
||||
--input-json GatherTradingData.json \
|
||||
--sqlite-db outputs/kis_data_collection/kis_data_collection.db \
|
||||
|
||||
Reference in New Issue
Block a user