Use new folder for added PIS Codes

This commit is contained in:
Fred Boniface 2024-03-08 11:44:18 +00:00
parent c23baffa36
commit fddda2063e
1 changed files with 3 additions and 2 deletions

View File

@ -11,6 +11,7 @@ HEADERS = {
'accept': 'application/json',
}
BRANCH_NAME = 'auto-' + datetime.now().strftime("%Y%m%d-%H%M%S")
FILE_NAME = 'dg_parser_' + datetime.now().strftime("%Y%m%d-%H%M%S")
'''
@ -31,9 +32,9 @@ def clone_repository():
def commit_and_push_changes(text_to_append, commit_message):
repo = git.Repo(REPO_PATH)
repo.git.checkout("-b", BRANCH_NAME)
with open(REPO_PATH + "/pis/gw.yaml", 'a') as file:
with open(REPO_PATH + f"/pis/{FILE_NAME}.yaml", 'w') as file:
file.write(text_to_append)
repo.index.add(["pis/gw.yaml"])
repo.index.add([f"pis/{FILE_NAME}.yaml"])
repo.index.commit(commit_message)
origin = repo.remote(name='origin')
origin_url_credentials = REPO_URL.replace('https://', f'https://{USER}:{TOKEN}@')