news update
All checks were successful
Modelari site build and deploy / Build-site (push) Successful in 19s
All checks were successful
Modelari site build and deploy / Build-site (push) Successful in 19s
This commit is contained in:
15
edit.py
15
edit.py
@@ -3,10 +3,23 @@ from tkinter import messagebox
|
||||
from tkinter import filedialog
|
||||
import os
|
||||
import shutil
|
||||
from git import Repo
|
||||
|
||||
PATH_OF_GIT_REPO = r'.git'
|
||||
COMMIT_MESSAGE = 'news update'
|
||||
HTML_INSERT_TAG = "<!-- INSERT HERE -->"
|
||||
uploaded_image_path = None # Global to track uploaded image
|
||||
|
||||
def git_push():
|
||||
try:
|
||||
repo = Repo(PATH_OF_GIT_REPO)
|
||||
repo.git.add(update=True)
|
||||
repo.index.commit(COMMIT_MESSAGE)
|
||||
origin = repo.remote(name='origin')
|
||||
origin.push()
|
||||
except:
|
||||
messagebox.showerror("Git error", "Something went wrong while pushing to origin")
|
||||
|
||||
def upload_image():
|
||||
global uploaded_image_path
|
||||
path = filedialog.askopenfilename(
|
||||
@@ -94,6 +107,8 @@ def submit_content():
|
||||
except Exception as e:
|
||||
messagebox.showerror("Error", str(e))
|
||||
|
||||
git_push()
|
||||
|
||||
|
||||
# GUI Setup
|
||||
root = tk.Tk()
|
||||
|
||||
Reference in New Issue
Block a user