Minor change for webhooks
This commit is contained in:
parent
f39fcc9924
commit
b1b691a368
10
main.py
10
main.py
|
|
@ -27,14 +27,16 @@ async def github_webhook(request: Request):
|
||||||
payload = await request.json()
|
payload = await request.json()
|
||||||
print("[WEBHOOK] Received webhook:", payload.get("head_commit", {}).get("message"))
|
print("[WEBHOOK] Received webhook:", payload.get("head_commit", {}).get("message"))
|
||||||
|
|
||||||
# Run update script (you can improve security here)
|
|
||||||
try:
|
try:
|
||||||
script_path = os.path.join(os.path.dirname(__file__), "update_hmi.sh")
|
# Call the update script on the HOST using host bash
|
||||||
subprocess.run([script_path], check=True)
|
subprocess.run(
|
||||||
|
["/usr/bin/bash", "-c", "bash /home/hmi/Desktop/HMI/update_hmi.sh"],
|
||||||
|
check=True
|
||||||
|
)
|
||||||
return {"status": "Update triggered"}
|
return {"status": "Update triggered"}
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
return {"status": "Update failed", "error": str(e)}
|
return {"status": "Update failed", "error": str(e)}
|
||||||
|
|
||||||
|
|
||||||
@app.post("/connect_toggle")
|
@app.post("/connect_toggle")
|
||||||
def connect_toggle():
|
def connect_toggle():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user