From 670527ec657396f01e9d06a5cbaf897508e6038c Mon Sep 17 00:00:00 2001 From: Zachery Koppert Date: Thu, 30 Nov 2023 11:26:25 -0800 Subject: [PATCH] Only check spnosor_info for boolean if it exists. Signed-off-by: Zachery Koppert --- .env-example | 1 - env.py | 15 +++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.env-example b/.env-example index 0962d6a..8253b5e 100644 --- a/.env-example +++ b/.env-example @@ -4,4 +4,3 @@ ORGANIZATION = "organization" START_DATE = "" END_DATE = "" GH_ENTERPRISE_URL=" " -SPONSOR_INFO = "False" diff --git a/env.py b/env.py index faca75a..5240807 100644 --- a/env.py +++ b/env.py @@ -1,4 +1,7 @@ -"""A GitHub Action that given an organization or repository, produces information about the contributors over the specified time period.""" +""" +A GitHub Action that given an organization or repository, +produces information about the contributors over the specified time period. +""" import os from os.path import dirname, join @@ -35,7 +38,7 @@ def get_env_vars() -> ( # Either organization or repository must be set if not organization and not repositories_str: raise ValueError( - "ORGANIZATION and REPOSITORY environment variables were both not set. Please enter a valid value for one of them." + "ORGANIZATION and REPOSITORY environment variables were not set. Please set one" ) token = os.getenv("GH_TOKEN") @@ -59,10 +62,10 @@ def get_env_vars() -> ( # make sure that sponsor_string is a boolean if sponsor_info: sponsor_info = sponsor_info.lower().strip() - if sponsor_info not in ["true", "false", ""]: - raise ValueError( - "SPONSOR_INFO environment variable not a boolean. ie. True or False or blank" - ) + if sponsor_info not in ["true", "false", ""]: + raise ValueError( + "SPONSOR_INFO environment variable not a boolean. ie. True or False or blank" + ) # Separate repositories_str into a list based on the comma separator repositories_list = []