diff --git a/ghmap/cli.py b/ghmap/cli.py index d834e82..f83db51 100644 --- a/ghmap/cli.py +++ b/ghmap/cli.py @@ -1,10 +1,11 @@ """Command-line interface for the GitHub Event Mapping Tool.""" import argparse -from pathlib import Path from datetime import datetime, timezone from importlib.resources import files +from pathlib import Path from typing import Dict, List, Tuple + from .preprocess.event_processor import EventProcessor from .mapping.action_mapper import ActionMapper from .mapping.activity_mapper import ActivityMapper @@ -15,7 +16,7 @@ def extract_version_info(filename: str) -> Tuple[str, datetime]: """Extract platform and version date from mapping filename. Expected format: {platform}_{type}_{date}.json - Example: github_action_2025-10-08T16:59:23Z.json + Example: github_action_20251008T165923Z.json (ISO 8601 Basic Format) """ # Remove .json extension and split base_name = filename.replace('.json', '') @@ -27,8 +28,15 @@ def extract_version_info(filename: str) -> Tuple[str, datetime]: # Version date is last part (after last underscore) version_str = parts[-1] - # Parse ISO format date - version_date = datetime.fromisoformat(version_str.replace('Z', '+00:00')) + # Parse ISO 8601 Basic Format: YYYYMMDDTHHMMSSZ + try: + version_date = datetime.strptime(version_str, '%Y%m%dT%H%M%SZ') + version_date = version_date.replace(tzinfo=timezone.utc) + except ValueError as e: + raise ValueError( + f"Invalid timestamp format: {version_str}. " + f"Expected format: YYYYMMDDTHHMMSSZ (e.g., 20251008T165923Z)" + ) from e return platform, version_date diff --git a/ghmap/config/github_action_2015-01-01T00:00:00Z.json b/ghmap/config/github_action_20150101T000000Z.json similarity index 99% rename from ghmap/config/github_action_2015-01-01T00:00:00Z.json rename to ghmap/config/github_action_20150101T000000Z.json index 4768c8c..0f7e2b9 100644 --- a/ghmap/config/github_action_2015-01-01T00:00:00Z.json +++ b/ghmap/config/github_action_20150101T000000Z.json @@ -627,4 +627,4 @@ } } } -} \ No newline at end of file +} diff --git a/ghmap/config/github_action_2025-10-08T16:59:23Z.json b/ghmap/config/github_action_20251008T165923Z.json similarity index 99% rename from ghmap/config/github_action_2025-10-08T16:59:23Z.json rename to ghmap/config/github_action_20251008T165923Z.json index 955e1e0..21c0310 100644 --- a/ghmap/config/github_action_2025-10-08T16:59:23Z.json +++ b/ghmap/config/github_action_20251008T165923Z.json @@ -1094,4 +1094,4 @@ } } } -} \ No newline at end of file +} diff --git a/ghmap/config/github_activity_2015-01-01T00:00:00Z.json b/ghmap/config/github_activity_20150101T000000Z.json similarity index 99% rename from ghmap/config/github_activity_2015-01-01T00:00:00Z.json rename to ghmap/config/github_activity_20150101T000000Z.json index 1045f69..706595a 100644 --- a/ghmap/config/github_activity_2015-01-01T00:00:00Z.json +++ b/ghmap/config/github_activity_20150101T000000Z.json @@ -420,4 +420,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/ghmap/config/github_activity_2025-10-08T16:59:23Z.json b/ghmap/config/github_activity_20251008T165923Z.json similarity index 99% rename from ghmap/config/github_activity_2025-10-08T16:59:23Z.json rename to ghmap/config/github_activity_20251008T165923Z.json index 4222a94..35995f8 100644 --- a/ghmap/config/github_activity_2025-10-08T16:59:23Z.json +++ b/ghmap/config/github_activity_20251008T165923Z.json @@ -721,4 +721,4 @@ ] } ] -} \ No newline at end of file +}