Skip to content

Commit

Permalink
Added default directory envkey option
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelOnFira committed May 7, 2021
1 parent 8b294d5 commit beb6b69
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/create-envfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
out_file += key.split("INPUT_ENVKEY_")[1] + "=" + os.environ.get(key) + "\n"

# get directory name in which we want to create .env file
directory = str(os.environ.get("INPUT_DIRECTORY"))
directory = str(os.environ.get("INPUT_DIRECTORY", ""))

# get file name in which we want to add variables
# .env is set by default
file_name = str(os.environ.get("INPUT_FILE_NAME"))

path = str(os.environ.get("INPUT_GITHUB_WORKSPACE"))
path = str(os.environ.get("GITHUB_WORKSPACE", ""))
if path == "":
raise Exception("Could not get the GITHUB_WORKSPACE environment variable.")
raise Exception("Could not get the GITHUB_WORKSPACE environment variable.")

with open(os.path.join(path, directory, file_name), "w") as text_file:
text_file.write(out_file)

0 comments on commit beb6b69

Please sign in to comment.