INNER CODE UNIT · Python
candidate
DataTalksClub/datatalksclub.github.io · scripts/add_dateadded_from_git.py:43
candidate = project_root / podcast_file
if candidate.exists():
return candidate.resolve()
return None
def get_file_creation_date(file_path: Path) -> Optional[str]:
"""
Get the date when a file was first added to git.
Returns the date in YYYY-MM-DD format, or None if not found.
"""
project_root = get_project_root()
# Get relative path from project root
try:
rel_path = file_path.relative_to(project_root)
except ValueError:
# File is not under project root