generated from nhcarrigan/template
docs: add data file documentation and fix data path resolution
All Python cohort scripts now use DATA_DIR = Path(__file__).parent.parent.parent / "data" to correctly resolve the repo-root data/ directory regardless of the working directory set by run.sh. All TypeScript scripts have expanded JSDoc headers documenting data file requirements and environment variables.
This commit is contained in:
@@ -3,9 +3,12 @@
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import aiohttp
|
||||
|
||||
DATA_DIR = Path(__file__).parent.parent.parent / "data"
|
||||
|
||||
DISCORD_BOT_TOKEN = os.environ["DISCORD_BOT_TOKEN"]
|
||||
GUILD_ID = "692816967895220344"
|
||||
|
||||
@@ -62,13 +65,13 @@ def generate_roster(team: dict, discord_to_github: dict) -> str:
|
||||
|
||||
async def main() -> None:
|
||||
"""Update roster messages for all teams."""
|
||||
with open("team_message_ids.json") as f:
|
||||
with open(DATA_DIR / "team_message_ids.json") as f:
|
||||
team_data = json.load(f)
|
||||
|
||||
with open("team_assignments.json") as f:
|
||||
with open(DATA_DIR / "team_assignments.json") as f:
|
||||
teams = json.load(f)
|
||||
|
||||
with open("discord_to_github.json") as f:
|
||||
with open(DATA_DIR / "discord_to_github.json") as f:
|
||||
discord_to_github = json.load(f)
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
|
||||
Reference in New Issue
Block a user