-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📝 Chore(Actions): Only build on existing new commit.
- Loading branch information
1 parent
f7c80bd
commit 296cf15
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |