Skip to content

Commit

Permalink
Fix datetime iso format
Browse files Browse the repository at this point in the history
  • Loading branch information
Aemiii91 committed May 18, 2024
1 parent 3bdc3d5 commit cc58bc5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def set_ordering(file_path: str, ordering: list[str]):
def dir_has_files(dir_path: str, files: list[str]):
return all(os.path.exists(os.path.join(dir_path, file)) for file in files)


def git_last_changed(path: str) -> datetime:
git_result = subprocess.run(["git", "log", "-1", "--pretty=%cI", path], stdout=subprocess.PIPE, check=True)
datestr = git_result.stdout.decode('utf-8').strip()
if 'T' in datestr:
datestr = datestr.split("T")[0]
return datetime.fromisoformat(datestr).strftime("%Y-%m-%d") if datestr else None

0 comments on commit cc58bc5

Please sign in to comment.