From 2185ac95c87af4cf93d76f1866152767735a4896 Mon Sep 17 00:00:00 2001 From: Rankin Zheng Date: Tue, 10 Sep 2024 15:38:26 +0800 Subject: [PATCH 1/3] fix(devchat): correct update_custom_workflows return statements Correct the return statement in `update_custom_workflows` to explicitly pass `False` for the `updated` field and provide a clearer message for the `message` field. This change ensures consistent return type and improves the readability of the status messages. --- devchat/_service/route/workflows.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devchat/_service/route/workflows.py b/devchat/_service/route/workflows.py index 95b051c9..208859f5 100644 --- a/devchat/_service/route/workflows.py +++ b/devchat/_service/route/workflows.py @@ -132,7 +132,7 @@ def update_custom_workflows(): return response.UpdateWorkflows(updated=updated_any, message=message_summary) else: return response.UpdateWorkflows( - False, "No custom_git_urls found in .chat/config.yaml" + updated=False, message="No custom_git_urls found in .chat/config.yaml" ) else: - return response.UpdateWorkflows(False, "No .chat config found") + return response.UpdateWorkflows(updated=False, message="No .chat config found") From c2edf54c526de971a936dea4645e8d8a024603a1 Mon Sep 17 00:00:00 2001 From: Rankin Zheng Date: Wed, 18 Sep 2024 16:14:04 +0800 Subject: [PATCH 2/3] refactor(workflows): clone custom git repos using provided branch Update the clone process for custom git repositories by utilizing the specific branch information supplied in the workflow configuration. This change allows for more flexible and accurate repository management compared to the previous hardcoded approach. --- devchat/_service/route/workflows.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/devchat/_service/route/workflows.py b/devchat/_service/route/workflows.py index 208859f5..34fb40d1 100644 --- a/devchat/_service/route/workflows.py +++ b/devchat/_service/route/workflows.py @@ -91,10 +91,12 @@ def update_custom_workflows(): updated_any = True update_messages = [] - for url in custom_git_urls: - repo_name = url.split("/")[-1].replace(".git", "") # 提取repo名称 + for item in custom_git_urls: + git_url = item['git_url'] + branch = item['branch'] + repo_name = git_url.split("/")[-1].replace(".git", "") # 提取repo名称 repo_path: Path = base_path / repo_name # 拼接出clone路径 - candidates_git_urls = [(url, "main")] + candidates_git_urls = [(git_url,branch)] if repo_path.exists(): logger.info(f"Repo path not empty {repo_path}, removing it.") From 97aae00a8c4988ca36e43bd03140cb99bed40916 Mon Sep 17 00:00:00 2001 From: kagami Date: Mon, 23 Sep 2024 09:49:12 +0800 Subject: [PATCH 3/3] Fix style issue --- devchat/_service/route/workflows.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/devchat/_service/route/workflows.py b/devchat/_service/route/workflows.py index 34fb40d1..a09cdb45 100644 --- a/devchat/_service/route/workflows.py +++ b/devchat/_service/route/workflows.py @@ -92,11 +92,11 @@ def update_custom_workflows(): update_messages = [] for item in custom_git_urls: - git_url = item['git_url'] - branch = item['branch'] + git_url = item["git_url"] + branch = item["branch"] repo_name = git_url.split("/")[-1].replace(".git", "") # 提取repo名称 repo_path: Path = base_path / repo_name # 拼接出clone路径 - candidates_git_urls = [(git_url,branch)] + candidates_git_urls = [(git_url, branch)] if repo_path.exists(): logger.info(f"Repo path not empty {repo_path}, removing it.") @@ -134,7 +134,7 @@ def update_custom_workflows(): return response.UpdateWorkflows(updated=updated_any, message=message_summary) else: return response.UpdateWorkflows( - updated=False, message="No custom_git_urls found in .chat/config.yaml" + updated=False, message="No custom_git_urls found in .chat/config.yaml" ) else: return response.UpdateWorkflows(updated=False, message="No .chat config found")