cast to int

This commit is contained in:
2025-07-11 21:43:21 -05:00
parent cffc51f65a
commit bf12558e31
2 changed files with 10 additions and 11 deletions

View File

@@ -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 = os.environ.get('STALE_DAYS') stale_days = int(os.environ.get('STALE_DAYS'))
stale_tag = os.environ.get('STALE_TAG', 'stale') stale_tag = int(os.environ.get('STALE_TAG'))
exclude_tag = os.environ.get('EXCLUDE_TAG') exclude_tag = int(os.environ.get('EXCLUDE_TAG'))
required_tag = os.environ.get('REQUIRED_TAG') required_tag = int(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)

View File

@@ -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 = os.environ.get('STALE_DAYS') stale_days = int(os.environ.get('STALE_DAYS'))
stale_tag = os.environ.get('STALE_TAG', 'stale') stale_tag = int(os.environ.get('STALE_TAG'))
exclude_tag = os.environ.get('EXCLUDE_TAG') exclude_tag = int(os.environ.get('EXCLUDE_TAG'))
required_tag = os.environ.get('REQUIRED_TAG') required_tag = int(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)
@@ -40,7 +40,6 @@ def main():
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
@@ -105,11 +104,11 @@ def main():
continue continue
print(f">> Will tag PR #{pr_number} with '{stale_tag}'") print(f">> Will tag PR #{pr_number} with '{stale_tag}'")
update_labels = list(update_labels | {stale_tag}) update_labels.add(stale_tag)
# --- Make update with new labels --- # --- Make update with new labels ---
update_payload = {'labels': update_labels} update_payload = {'labels': list(update_labels)}
update_url = f"{base_api_url}/{pr_number}/labels" update_url = f"{base_api_url}/{pr_number}/labels"
print(f">> Updating PR #{pr_number} ...") print(f">> Updating PR #{pr_number} ...")