refactor int cast
This commit is contained in:
@@ -12,10 +12,10 @@ def main():
|
|||||||
instance_url = os.environ['INSTANCE_URL'].rstrip('/')
|
instance_url = os.environ['INSTANCE_URL'].rstrip('/')
|
||||||
repository = os.environ['REPOSITORY']
|
repository = os.environ['REPOSITORY']
|
||||||
token = os.environ['TOKEN']
|
token = os.environ['TOKEN']
|
||||||
stale_days = int(os.environ.get('STALE_DAYS'))
|
stale_days = os.environ.get('STALE_DAYS')
|
||||||
stale_tag = int(os.environ.get('STALE_TAG'))
|
stale_tag = os.environ.get('STALE_TAG')
|
||||||
exclude_tag = int(os.environ.get('EXCLUDE_TAG'))
|
exclude_tag = os.environ.get('EXCLUDE_TAG')
|
||||||
required_tag = int(os.environ.get('REQUIRED_TAG'))
|
required_tag = os.environ.get('REQUIRED_TAG')
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
print(f"Error: Missing required environment variable: {e}", file=sys.stderr)
|
print(f"Error: Missing required environment variable: {e}", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@@ -26,12 +26,14 @@ def main():
|
|||||||
enable_required_tag = False
|
enable_required_tag = False
|
||||||
print(f">> No optional required tag set.")
|
print(f">> No optional required tag set.")
|
||||||
else:
|
else:
|
||||||
|
required_tag = int(required_tag)
|
||||||
enable_required_tag = True
|
enable_required_tag = True
|
||||||
|
|
||||||
if exclude_tag == None:
|
if exclude_tag == None:
|
||||||
enable_exclude_tag= False
|
enable_exclude_tag= False
|
||||||
print(f">> No optional exclusive tag set.")
|
print(f">> No optional exclusive tag set.")
|
||||||
else:
|
else:
|
||||||
|
exclude_tag = int(exclude_tag)
|
||||||
enable_exclude_tag = True
|
enable_exclude_tag = True
|
||||||
|
|
||||||
if stale_days == None:
|
if stale_days == None:
|
||||||
@@ -42,6 +44,8 @@ def main():
|
|||||||
older_than_date = datetime.now(timezone.utc) - timedelta(days=stale_days)
|
older_than_date = datetime.now(timezone.utc) - timedelta(days=stale_days)
|
||||||
enable_stale_tag = True
|
enable_stale_tag = True
|
||||||
|
|
||||||
|
stale_tag = int(stale_tag)
|
||||||
|
|
||||||
|
|
||||||
# --- Check if any actions are enabled ---
|
# --- Check if any actions are enabled ---
|
||||||
if not any([enable_stale_tag]) == True:
|
if not any([enable_stale_tag]) == True:
|
||||||
|
@@ -12,10 +12,10 @@ def main():
|
|||||||
instance_url = os.environ['INSTANCE_URL'].rstrip('/')
|
instance_url = os.environ['INSTANCE_URL'].rstrip('/')
|
||||||
repository = os.environ['REPOSITORY']
|
repository = os.environ['REPOSITORY']
|
||||||
token = os.environ['TOKEN']
|
token = os.environ['TOKEN']
|
||||||
stale_days = int(os.environ.get('STALE_DAYS'))
|
stale_days = os.environ.get('STALE_DAYS')
|
||||||
stale_tag = int(os.environ.get('STALE_TAG'))
|
stale_tag = os.environ.get('STALE_TAG')
|
||||||
exclude_tag = int(os.environ.get('EXCLUDE_TAG'))
|
exclude_tag = os.environ.get('EXCLUDE_TAG')
|
||||||
required_tag = int(os.environ.get('REQUIRED_TAG'))
|
required_tag = os.environ.get('REQUIRED_TAG')
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
print(f"Error: Missing required environment variable: {e}", file=sys.stderr)
|
print(f"Error: Missing required environment variable: {e}", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@@ -28,21 +28,26 @@ def main():
|
|||||||
enable_required_tag = False
|
enable_required_tag = False
|
||||||
print(f">> No optional required tag set.")
|
print(f">> No optional required tag set.")
|
||||||
else:
|
else:
|
||||||
|
required_tag = int(required_tag)
|
||||||
enable_required_tag = True
|
enable_required_tag = True
|
||||||
|
|
||||||
if exclude_tag == None:
|
if exclude_tag == None:
|
||||||
enable_exclude_tag= False
|
enable_exclude_tag= False
|
||||||
print(f">> No optional exclusive tag set.")
|
print(f">> No optional exclusive tag set.")
|
||||||
else:
|
else:
|
||||||
|
exclude_tag = int(exclude_tag)
|
||||||
enable_exclude_tag = True
|
enable_exclude_tag = True
|
||||||
|
|
||||||
if stale_days == None:
|
if stale_days == None:
|
||||||
enable_stale_tag= False
|
enable_stale_tag= False
|
||||||
print(f">> No value for stale days.")
|
print(f">> No value for stale days.")
|
||||||
else:
|
else:
|
||||||
|
stale_days = int(stale_days)
|
||||||
older_than_date = datetime.now(timezone.utc) - timedelta(days=stale_days)
|
older_than_date = datetime.now(timezone.utc) - timedelta(days=stale_days)
|
||||||
enable_stale_tag = True
|
enable_stale_tag = True
|
||||||
|
|
||||||
|
stale_tag = int(stale_tag)
|
||||||
|
|
||||||
|
|
||||||
# --- Check if any actions are enabled ---
|
# --- Check if any actions are enabled ---
|
||||||
if not any([enable_stale_tag]) == True:
|
if not any([enable_stale_tag]) == True:
|
||||||
|
Reference in New Issue
Block a user