Skip to content

Commit

Permalink
Merge pull request #274 from Crequency/dev=main
Browse files Browse the repository at this point in the history
[Pull Request] New script for github action that check latest commit date
  • Loading branch information
Dynesshely committed Oct 28, 2023
2 parents f4ef39b + f865bd0 commit 10600f7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion KitX Clients/KitX Dashboard
2 changes: 1 addition & 1 deletion KitX Clients/KitX Installer
25 changes: 25 additions & 0 deletions ToolKits/Actions/check_new_commit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import sys
import os
from datetime import datetime, timedelta, timezone

current_utc_time = datetime.utcnow()
current_utc_time = current_utc_time.replace(tzinfo=timezone.utc)

print("Args list: ", sys.argv)

time_str = sys.argv[1]
days_deference = int(sys.argv[2])

datetime_obj = datetime.fromisoformat(time_str)
datetime_obj = datetime_obj.replace(tzinfo=timezone.utc)

time_difference = current_utc_time - datetime_obj

print("Time delta: ", time_difference)

if time_difference > timedelta(days=days_deference):
print("No new commit found. Check in env var: [HAS_NEW_COMMIT].")
os.putenv("HAS_NEW_COMMIT", "false")
else:
print("New commit found. Check in env var: [HAS_NEW_COMMIT].")
os.putenv("HAS_NEW_COMMIT", "true")

0 comments on commit 10600f7

Please sign in to comment.