Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created September 20, 2024 20:38
Show Gist options
  • Select an option

  • Save KyMidd/4e26f72483a9a63ade55db5f21357772 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/4e26f72483a9a63ade55db5f21357772 to your computer and use it in GitHub Desktop.
# Function
def initial_var_validation():
# Get env variable GITHUB_TOKEN, and if not present, exit
if 'GITHUB_TOKEN' not in os.environ:
print("GITHUB_TOKEN not found in environment variables")
exit(1)
# Read repo we should evluate as an environmental var
if 'GITHUB_ORG' not in os.environ:
print("GITHUB_ORG not found in environment variables")
exit(1)
return True
# Calling it
if initial_var_validation() == True:
GITHUB_ORG = os.environ['GITHUB_ORG']
GITHUB_TOKEN = os.environ['GITHUB_TOKEN']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment