From e32a40688e41593149c4b996ca5bad40566f4b7a Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 26 Dec 2025 16:01:46 -0800 Subject: [PATCH 01/17] improved embed for docker updates improved and edited embed for git and docker updates --- server.py | 51 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/server.py b/server.py index b0366d4..1ac772d 100644 --- a/server.py +++ b/server.py @@ -97,23 +97,46 @@ def push_update_success_as_discord_embed( repo_name = prefix + " " + repo_name # do a gray color if we are sending "not real" embeds color = 0x99AAB5 - + import os + commit = getattr(result, 'commit', None) + branch = getattr(result, 'branch', None) or getattr(repo_config, 'branch', 'main') + commit_id = getattr(result, 'commit_id', None) or (commit['id'][:7] if commit and 'id' in commit else 'unknown') + commit_url = getattr(result, 'commit_url', None) or (commit['url'] if commit and 'url' in commit else 'https://github.com/SCE-Development/') + commit_message = getattr(result, 'commit_message', None) or (commit['message'] if commit and 'message' in commit else 'No commit message') + author = getattr(result, 'author', None) or (commit['author'] if commit and 'author' in commit else {}) + author_name = author.get('name', 'unknown') + author_username = author.get('username', None) + author_url = f"https://github.com/{author_username}" if author_username else "https://github.com/" + user_env = os.environ.get('USER', 'unknown') + hostname_env = os.environ.get('HOSTNAME', 'unknown') + + # Title + title = f"[{repo_config.name}:{branch}] Deployment Successful [{commit_id}]({commit_url}) — {commit_message}" + # First line + first_line = f"Author: [{author_name}]({author_url}), environment: {user_env}@{hostname_env}" + # Exit codes + exit_codes = [ + f"• git pull exited with code **{result.git_exit_code}**", + f"• docker-compose up exited with code **{result.docker_exit_code}**", + ] + # Outputs (if any) + output_lines = [] + if result.git_stdout: + output_lines.append(f"• git stdout: **```{result.git_stdout}```**") + if result.git_stderr: + output_lines.append(f"• git stderr: **```{result.git_stderr}```**") + if result.docker_stdout: + output_lines.append(f"• docker-compose up stdout: **```{result.docker_stdout}```**") + if result.docker_stderr: + output_lines.append(f"• docker-compose up stderr: **```{result.docker_stderr}```**") + + description = "\n".join([first_line] + exit_codes + output_lines) embed_json = { "embeds": [ { - "title": f"{repo_name} was successfully updated", - "url": "https://github.com/SCE-Development/" - + repo_config.name, # link to CICD project repo - "description": "\n".join( - [ - f"• git pull exited with code **{result.git_exit_code}**", - f"• git stdout: **```{result.git_stdout or 'No output'}```**", - f"• git stderr: **```{result.git_stderr or 'No output'}```**", - f"• docker-compose up exited with code **{result.docker_exit_code}**", - f"• docker-compose up stdout: **```{result.docker_stdout or 'No output'}```**", - f"• docker-compose up stderr: **```{result.docker_stderr or 'No output'}```**", - ] - ), + "title": title, + "url": commit_url, + "description": description, "color": color, } ] From bbf280945709bd6f15e168a43ab7fa31d3edba24 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 26 Dec 2025 17:44:29 -0800 Subject: [PATCH 02/17] fixed author and environment embed fixed author and environment embed --- server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 1ac772d..0bf2dad 100644 --- a/server.py +++ b/server.py @@ -156,13 +156,14 @@ def push_update_success_as_discord_embed( logger.exception("push_update_success_as_discord_embed had a bad time") -def update_repo(repo_config: RepoToWatch) -> RepoUpdateResult: +def update_repo(repo_config: RepoToWatch, commit=None) -> RepoUpdateResult: MetricsHandler.last_push_timestamp.labels(repo=repo_config.name).set(time.time()) logger.info( f"updating {repo_config.name} to {repo_config.branch} in {repo_config.path}" ) result = RepoUpdateResult() + result.commit = commit if args.development: logging.warning("skipping command to update, we are in development mode") From 32208efa033259029a2b17b9c3d6a83e0f024ed0 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 26 Dec 2025 18:37:35 -0800 Subject: [PATCH 03/17] fix environment embed --- server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index 0bf2dad..7173fe3 100644 --- a/server.py +++ b/server.py @@ -107,8 +107,8 @@ def push_update_success_as_discord_embed( author_name = author.get('name', 'unknown') author_username = author.get('username', None) author_url = f"https://github.com/{author_username}" if author_username else "https://github.com/" - user_env = os.environ.get('USER', 'unknown') - hostname_env = os.environ.get('HOSTNAME', 'unknown') + user_env = os.environ.get('USER') or os.environ.get('USERNAME', 'unknown') + hostname_env = os.environ.get('HOSTNAME') or os.environ.get('COMPUTERNAME', 'unknown') # Title title = f"[{repo_config.name}:{branch}] Deployment Successful [{commit_id}]({commit_url}) — {commit_message}" From cc76e83701848da09a442c9ccd361e26e2107717 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 26 Dec 2025 23:45:28 -0800 Subject: [PATCH 04/17] codeblocks portion added for outputs --- server.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/server.py b/server.py index 7173fe3..f0e1967 100644 --- a/server.py +++ b/server.py @@ -97,7 +97,6 @@ def push_update_success_as_discord_embed( repo_name = prefix + " " + repo_name # do a gray color if we are sending "not real" embeds color = 0x99AAB5 - import os commit = getattr(result, 'commit', None) branch = getattr(result, 'branch', None) or getattr(repo_config, 'branch', 'main') commit_id = getattr(result, 'commit_id', None) or (commit['id'][:7] if commit and 'id' in commit else 'unknown') @@ -111,7 +110,7 @@ def push_update_success_as_discord_embed( hostname_env = os.environ.get('HOSTNAME') or os.environ.get('COMPUTERNAME', 'unknown') # Title - title = f"[{repo_config.name}:{branch}] Deployment Successful [{commit_id}]({commit_url}) — {commit_message}" + title = f"[{repo_config.name}:{branch}] Deployment Successful {commit_id} — {commit_message}" # First line first_line = f"Author: [{author_name}]({author_url}), environment: {user_env}@{hostname_env}" # Exit codes @@ -120,15 +119,16 @@ def push_update_success_as_discord_embed( f"• docker-compose up exited with code **{result.docker_exit_code}**", ] # Outputs (if any) + codeblocks = [ + ("git stdout",f result.git_stdout), + ("git stderr", result.git_stderr), + ("docker-compose up stdout", result.docker_stdout), + ("docker-compose up stderr", result.docker_stderr), + ] output_lines = [] - if result.git_stdout: - output_lines.append(f"• git stdout: **```{result.git_stdout}```**") - if result.git_stderr: - output_lines.append(f"• git stderr: **```{result.git_stderr}```**") - if result.docker_stdout: - output_lines.append(f"• docker-compose up stdout: **```{result.docker_stdout}```**") - if result.docker_stderr: - output_lines.append(f"• docker-compose up stderr: **```{result.docker_stderr}```**") + for title, value in codeblocks: + if value: + output_lines.append(f"• {title}: **```{value}```**") description = "\n".join([first_line] + exit_codes + output_lines) embed_json = { From c6ec6a96133613eee235390a92e69b672baf2217 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 27 Dec 2025 13:25:45 -0800 Subject: [PATCH 05/17] fixed markdown formatting embed --- server.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index f0e1967..3a3552d 100644 --- a/server.py +++ b/server.py @@ -5,6 +5,7 @@ import os import subprocess import threading +import socket from dotenv import load_dotenv import uvicorn @@ -15,7 +16,6 @@ import time from metrics import MetricsHandler - from prometheus_client import generate_latest @@ -107,7 +107,7 @@ def push_update_success_as_discord_embed( author_username = author.get('username', None) author_url = f"https://github.com/{author_username}" if author_username else "https://github.com/" user_env = os.environ.get('USER') or os.environ.get('USERNAME', 'unknown') - hostname_env = os.environ.get('HOSTNAME') or os.environ.get('COMPUTERNAME', 'unknown') + hostname_env = os.environ.get('HOSTNAME') or os.environ.get('COMPUTERNAME', 'unknown') or socket.gethostname() # Title title = f"[{repo_config.name}:{branch}] Deployment Successful {commit_id} — {commit_message}" @@ -126,9 +126,9 @@ def push_update_success_as_discord_embed( ("docker-compose up stderr", result.docker_stderr), ] output_lines = [] - for title, value in codeblocks: + for block_title, value in codeblocks: if value: - output_lines.append(f"• {title}: **```{value}```**") + output_lines.append(f"• {block_title}:\n```\n{value}\n```") description = "\n".join([first_line] + exit_codes + output_lines) embed_json = { @@ -227,6 +227,8 @@ async def github_webhook(request: Request): return {"status": f"not acting on repo and branch name of {key}"} logger.info(f"Push to {branch} detected for {repo_name}") + # extract commit info from payload + commit = payload.get("head.commit", {}) # update the repo thread = threading.Thread(target=update_repo, args=(config[key],)) thread.start() From e32938eebc8d9107011be6bf633b9a8596a47ecf Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 27 Dec 2025 23:06:33 -0800 Subject: [PATCH 06/17] test --- server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/server.py b/server.py index 3a3552d..26b52cc 100644 --- a/server.py +++ b/server.py @@ -275,3 +275,4 @@ def start_smee(): if __name__ == "__main__": start_smee() uvicorn.run("server:app", port=3000, reload=True) + #test commit From 53f1be35071bc35478677931decd870d3c05f147 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 27 Dec 2025 23:08:48 -0800 Subject: [PATCH 07/17] Update server.py --- server.py | 1 - 1 file changed, 1 deletion(-) diff --git a/server.py b/server.py index 26b52cc..3a3552d 100644 --- a/server.py +++ b/server.py @@ -275,4 +275,3 @@ def start_smee(): if __name__ == "__main__": start_smee() uvicorn.run("server:app", port=3000, reload=True) - #test commit From 1ceb4e5b534c7c020ac152e24f6440d4a88d531d Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 28 Dec 2025 13:24:42 -0800 Subject: [PATCH 08/17] fixed format for embed this fix only has "Deployment sucessful" as the title and the other points in the description part --- server.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 3a3552d..7b96b0f 100644 --- a/server.py +++ b/server.py @@ -130,7 +130,13 @@ def push_update_success_as_discord_embed( if value: output_lines.append(f"• {block_title}:\n```\n{value}\n```") - description = "\n".join([first_line] + exit_codes + output_lines) + description = "\n".join([ + repo_branch_line, + commit_line, + "", + author_env_line, + "" + ] + exit_codes + output_lines) embed_json = { "embeds": [ { From 6b53296e644d874030fdb3002ff47616e4e10177 Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 28 Dec 2025 13:45:56 -0800 Subject: [PATCH 09/17] changed to use github username as author --- server.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index 7b96b0f..95ec72b 100644 --- a/server.py +++ b/server.py @@ -110,10 +110,11 @@ def push_update_success_as_discord_embed( hostname_env = os.environ.get('HOSTNAME') or os.environ.get('COMPUTERNAME', 'unknown') or socket.gethostname() # Title - title = f"[{repo_config.name}:{branch}] Deployment Successful {commit_id} — {commit_message}" - # First line - first_line = f"Author: [{author_name}]({author_url}), environment: {user_env}@{hostname_env}" - # Exit codes + title = "Deployment successful" + # Description: + repo_branch_line = f"[{repo_config.name}:{branch}]" + commit_line = f"[{commit_id}]({commit_url}) — {commit_message}" + author_env_line = f"Author: [{author_username or author_name}]({author_url}), environment: {user_env}@{hostname_env}" exit_codes = [ f"• git pull exited with code **{result.git_exit_code}**", f"• docker-compose up exited with code **{result.docker_exit_code}**", From cacabbdb97e3792a0cef05b2327d01185b64a50f Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 28 Dec 2025 15:38:00 -0800 Subject: [PATCH 10/17] move fields to RepoUpdateResult Class moved fields to repoupdateresult class and built embed description with list. --- server.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/server.py b/server.py index 95ec72b..17d2e50 100644 --- a/server.py +++ b/server.py @@ -60,6 +60,14 @@ class RepoUpdateResult: git_stderr: str = "" docker_stdout: str = "" docker_stderr: str = "" + commit: dict = None + branch: str = "" + commit_id: str = "" + commit_url: str = "" + commit_message: str = "" + author: dict = None + author_name: str = "" + author_username: str = "" def load_config(development: bool): @@ -97,14 +105,14 @@ def push_update_success_as_discord_embed( repo_name = prefix + " " + repo_name # do a gray color if we are sending "not real" embeds color = 0x99AAB5 - commit = getattr(result, 'commit', None) - branch = getattr(result, 'branch', None) or getattr(repo_config, 'branch', 'main') - commit_id = getattr(result, 'commit_id', None) or (commit['id'][:7] if commit and 'id' in commit else 'unknown') - commit_url = getattr(result, 'commit_url', None) or (commit['url'] if commit and 'url' in commit else 'https://github.com/SCE-Development/') - commit_message = getattr(result, 'commit_message', None) or (commit['message'] if commit and 'message' in commit else 'No commit message') - author = getattr(result, 'author', None) or (commit['author'] if commit and 'author' in commit else {}) - author_name = author.get('name', 'unknown') - author_username = author.get('username', None) + commit = result.commit + branch = result.branch or getattr(repo_config, 'branch', 'main') + commit_id = result.commit_id or (commit['id'][:7] if commit and 'id' in commit else 'unknown') + commit_url = result.commit_url or (commit['url'] if commit and 'url' in commit else 'https://github.com/SCE-Development/') + commit_message = result.commit_message or (commit['message'] if commit and 'message' in commit else 'No commit message') + author = result.author or (commit['author'] if commit and 'author' in commit else {}) + author_name = result.author_name or author.get('name', 'unknown') + author_username = result.author_username or author.get('username', None) author_url = f"https://github.com/{author_username}" if author_username else "https://github.com/" user_env = os.environ.get('USER') or os.environ.get('USERNAME', 'unknown') hostname_env = os.environ.get('HOSTNAME') or os.environ.get('COMPUTERNAME', 'unknown') or socket.gethostname() @@ -131,13 +139,16 @@ def push_update_success_as_discord_embed( if value: output_lines.append(f"• {block_title}:\n```\n{value}\n```") - description = "\n".join([ + description_list = [ repo_branch_line, commit_line, "", author_env_line, "" - ] + exit_codes + output_lines) + ] + description_list.extend(exit_codes) + description_list.extend(output_lines) + description = "\n".join(description_list) embed_json = { "embeds": [ { From 1c3d4f6c440f14b2ae22145f879838465c8c5bce Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 28 Dec 2025 19:01:11 -0800 Subject: [PATCH 11/17] made changes to rely on result.author only --- server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.py b/server.py index 17d2e50..1d6bfdc 100644 --- a/server.py +++ b/server.py @@ -110,7 +110,7 @@ def push_update_success_as_discord_embed( commit_id = result.commit_id or (commit['id'][:7] if commit and 'id' in commit else 'unknown') commit_url = result.commit_url or (commit['url'] if commit and 'url' in commit else 'https://github.com/SCE-Development/') commit_message = result.commit_message or (commit['message'] if commit and 'message' in commit else 'No commit message') - author = result.author or (commit['author'] if commit and 'author' in commit else {}) + author = result.author or {} author_name = result.author_name or author.get('name', 'unknown') author_username = result.author_username or author.get('username', None) author_url = f"https://github.com/{author_username}" if author_username else "https://github.com/" From e54451c0b2a1d8ad7b0ff3b32ed60185ace77841 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 29 Dec 2025 09:03:22 -0800 Subject: [PATCH 12/17] Fixed default value to not use "or" + minor typos --- server.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/server.py b/server.py index 1d6bfdc..9f02916 100644 --- a/server.py +++ b/server.py @@ -55,7 +55,7 @@ class RepoToWatch: class RepoUpdateResult: git_exit_code: int = 0 docker_exit_code: int = 0 - development: bool = False + author: dict = dataclasses.field(default_factory=dict) git_stdout: str = "" git_stderr: str = "" docker_stdout: str = "" @@ -65,7 +65,6 @@ class RepoUpdateResult: commit_id: str = "" commit_url: str = "" commit_message: str = "" - author: dict = None author_name: str = "" author_username: str = "" @@ -110,7 +109,7 @@ def push_update_success_as_discord_embed( commit_id = result.commit_id or (commit['id'][:7] if commit and 'id' in commit else 'unknown') commit_url = result.commit_url or (commit['url'] if commit and 'url' in commit else 'https://github.com/SCE-Development/') commit_message = result.commit_message or (commit['message'] if commit and 'message' in commit else 'No commit message') - author = result.author or {} + author = result.author author_name = result.author_name or author.get('name', 'unknown') author_username = result.author_username or author.get('username', None) author_url = f"https://github.com/{author_username}" if author_username else "https://github.com/" @@ -129,7 +128,7 @@ def push_update_success_as_discord_embed( ] # Outputs (if any) codeblocks = [ - ("git stdout",f result.git_stdout), + ("git stdout", result.git_stdout), ("git stderr", result.git_stderr), ("docker-compose up stdout", result.docker_stdout), ("docker-compose up stderr", result.docker_stderr), @@ -246,9 +245,9 @@ async def github_webhook(request: Request): logger.info(f"Push to {branch} detected for {repo_name}") # extract commit info from payload - commit = payload.get("head.commit", {}) + commit = payload.get("head_commit", {}) # update the repo - thread = threading.Thread(target=update_repo, args=(config[key],)) + thread = threading.Thread(target=update_repo, args=(config[key], commit)) thread.start() return {"status": "webhook received"} From db2d591ceb27d8431d422044b8c59c3dba795144 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 29 Dec 2025 17:14:22 -0800 Subject: [PATCH 13/17] separated dataclasses for commit and author --- server.py | 52 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/server.py b/server.py index 9f02916..81cb888 100644 --- a/server.py +++ b/server.py @@ -50,23 +50,30 @@ class RepoToWatch: branch: str path: str +@dataclasses.dataclass +class Author: + name: str = "" + url: str = "" + username: str = "" + +@dataclasses.dataclass +class Commit: + id: str = "" + message: str = "" + branch: str = "" + url: str = "" @dataclasses.dataclass class RepoUpdateResult: git_exit_code: int = 0 docker_exit_code: int = 0 - author: dict = dataclasses.field(default_factory=dict) + author: Author = dataclasses.field(default_factory=Author) + commit: Commit = dataclasses.field(default_factory=Commit) git_stdout: str = "" git_stderr: str = "" docker_stdout: str = "" docker_stderr: str = "" - commit: dict = None - branch: str = "" - commit_id: str = "" - commit_url: str = "" - commit_message: str = "" - author_name: str = "" - author_username: str = "" + development: bool = False def load_config(development: bool): @@ -105,14 +112,14 @@ def push_update_success_as_discord_embed( # do a gray color if we are sending "not real" embeds color = 0x99AAB5 commit = result.commit - branch = result.branch or getattr(repo_config, 'branch', 'main') - commit_id = result.commit_id or (commit['id'][:7] if commit and 'id' in commit else 'unknown') - commit_url = result.commit_url or (commit['url'] if commit and 'url' in commit else 'https://github.com/SCE-Development/') - commit_message = result.commit_message or (commit['message'] if commit and 'message' in commit else 'No commit message') + branch = commit.branch or getattr(repo_config, 'branch', 'main') + commit_id = commit.id[:7] if commit.id else 'unknown' + commit_url = commit.url or 'https://github.com/SCE-Development/' + commit_message = commit.message or 'No commit message' author = result.author - author_name = result.author_name or author.get('name', 'unknown') - author_username = result.author_username or author.get('username', None) - author_url = f"https://github.com/{author_username}" if author_username else "https://github.com/" + author_name = author.name or 'unknown' + author_username = author.username or None + author_url = author.url or (f"https://github.com/{author_username}" if author_username else "https://github.com/") user_env = os.environ.get('USER') or os.environ.get('USERNAME', 'unknown') hostname_env = os.environ.get('HOSTNAME') or os.environ.get('COMPUTERNAME', 'unknown') or socket.gethostname() @@ -178,9 +185,18 @@ def update_repo(repo_config: RepoToWatch, commit=None) -> RepoUpdateResult: logger.info( f"updating {repo_config.name} to {repo_config.branch} in {repo_config.path}" ) - - result = RepoUpdateResult() - result.commit = commit + # Parse commit and author from dicts if provided + commit_obj = Commit() + author_obj = Author() + if commit: + commit_obj.id = commit.get('id', '') + commit_obj.message = commit.get('message', '') + commit_obj.branch = commit.get('branch', '') + commit_obj.url = commit.get('url', '') + author_info = commit.get('author', {}) + author_obj.name = author_info.get('name', '') + author_obj.username = author_info.get('username', '') + author_obj.url = author_info.get('url', '') if args.development: logging.warning("skipping command to update, we are in development mode") From 0391195b506434840d74b73fab33a632415f684c Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 30 Dec 2025 11:49:42 -0800 Subject: [PATCH 14/17] move default messages to class --- server.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server.py b/server.py index 81cb888..cbefeca 100644 --- a/server.py +++ b/server.py @@ -52,14 +52,14 @@ class RepoToWatch: @dataclasses.dataclass class Author: - name: str = "" + name: str = "unknown" url: str = "" - username: str = "" + username: str = None @dataclasses.dataclass class Commit: id: str = "" - message: str = "" + message: str = "No commit message" branch: str = "" url: str = "" @@ -115,10 +115,10 @@ def push_update_success_as_discord_embed( branch = commit.branch or getattr(repo_config, 'branch', 'main') commit_id = commit.id[:7] if commit.id else 'unknown' commit_url = commit.url or 'https://github.com/SCE-Development/' - commit_message = commit.message or 'No commit message' + commit_message = commit.message author = result.author - author_name = author.name or 'unknown' - author_username = author.username or None + author_name = author.name + author_username = author.username author_url = author.url or (f"https://github.com/{author_username}" if author_username else "https://github.com/") user_env = os.environ.get('USER') or os.environ.get('USERNAME', 'unknown') hostname_env = os.environ.get('HOSTNAME') or os.environ.get('COMPUTERNAME', 'unknown') or socket.gethostname() From 4562f8a57ae60bd8fe8511208be02a01585e5e86 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 30 Dec 2025 16:17:48 -0800 Subject: [PATCH 15/17] Update Author and Commit URLs to best use case --- server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index cbefeca..a019c57 100644 --- a/server.py +++ b/server.py @@ -53,7 +53,7 @@ class RepoToWatch: @dataclasses.dataclass class Author: name: str = "unknown" - url: str = "" + url: str = "https://github.com/" username: str = None @dataclasses.dataclass @@ -61,7 +61,7 @@ class Commit: id: str = "" message: str = "No commit message" branch: str = "" - url: str = "" + url: str = "https://github.com/SCE-Development/" @dataclasses.dataclass class RepoUpdateResult: @@ -120,8 +120,8 @@ def push_update_success_as_discord_embed( author_name = author.name author_username = author.username author_url = author.url or (f"https://github.com/{author_username}" if author_username else "https://github.com/") - user_env = os.environ.get('USER') or os.environ.get('USERNAME', 'unknown') - hostname_env = os.environ.get('HOSTNAME') or os.environ.get('COMPUTERNAME', 'unknown') or socket.gethostname() + user_env = getpass.getuser() + hostname_env = socket.gethostname() # Title title = "Deployment successful" From ba6609754321e61049ad9a092934c98d6d43a7cb Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 30 Dec 2025 16:19:03 -0800 Subject: [PATCH 16/17] Add getpass import to server.py --- server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/server.py b/server.py index a019c57..b839195 100644 --- a/server.py +++ b/server.py @@ -3,6 +3,7 @@ import json import logging import os +import getpass import subprocess import threading import socket From 1034abc9f01415ab4002dc37712dfd0121a29fbc Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 3 Jan 2026 21:45:44 -0800 Subject: [PATCH 17/17] Update deployment title based on result status --- server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index b839195..8b56020 100644 --- a/server.py +++ b/server.py @@ -125,7 +125,10 @@ def push_update_success_as_discord_embed( hostname_env = socket.gethostname() # Title - title = "Deployment successful" + if hasattr(result, 'rollback_message') and result.rollback_message: + title = "Deployment Failed" + else: + title = "Deployment Successful" # Description: repo_branch_line = f"[{repo_config.name}:{branch}]" commit_line = f"[{commit_id}]({commit_url}) — {commit_message}"