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