Skip to content

Commit

Permalink
update again
Browse files Browse the repository at this point in the history
  • Loading branch information
bossOfCode committed Aug 23, 2024
1 parent 941ac7b commit e2fe829
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import sys
import uuid

version = os.environ.get("INPUTS_UUID")
VERSION = os.environ.get("INPUTS_UUID")
namespace = os.environ.get("INPUTS_NAMESPACE")
name = os.environ.get("INPUTS_NAME")

OUTPUT = ""

versions = [1, 3, 4, 5]
namespaces = ["DNS", "URL", "OID", "X500"]

Expand All @@ -15,28 +17,28 @@ def print_in_os(argument):
print(f"{argument}")
os.system(f"{argument}")

if version in versions or namespace in namespaces:
if version == 1:
output = str(uuid.uuid1())
if VERSION in versions or namespace in namespaces:
if VERSION == 1:
OUTPUT = str(uuid.uuid1())
else:
if version == 3:
output = str(uuid.uuid3(str("NAMESPACES_" + namespace), name))
if VERSION == 3:
OUTPUT = str(uuid.uuid3(str("NAMESPACES_" + namespace), name))
else:
if version == 4:
output = str(uuid.uuid4())
if VERSION == 4:
OUTPUT = str(uuid.uuid4())
else:
if version == 5:
output = str(uuid.uuid5(str("NAMESPACES_" + namespace), name))
if VERSION == 5:
OUTPUT = str(uuid.uuid5(str("NAMESPACES_" + namespace), name))
else:
if namespace in namespaces:
sys.exit(f"ERROR: namespace cannot be {namespace}; must be either DNS, URL, OID, or X500.")
else:
if version in versions:
sys.exit(f"ERROR: version {version} does not exist")
if VERSION in versions:
sys.exit(f"ERROR: VERSION {VERSION} does not exist")

SAFE = uuid.SafeUUID

print_in_os(f"echo 'uuid={output}' >> $GITHUB_OUTPUT")
print_in_os(f"echo 'uuid={OUTPUT}' >> $GITHUB_OUTPUT")
print_in_os(f"echo 'safe={SAFE}' >> $GITHUB_OUTPUT")

if SAFE == "unsafe":
Expand Down

0 comments on commit e2fe829

Please sign in to comment.