-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from devchat-ai/update_workflows
Refactor and Enhance PR Creation and Review Features
- Loading branch information
Showing
9 changed files
with
168 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import json | ||
import os | ||
import sys | ||
|
||
from lib.chatmark import Checkbox | ||
|
||
# Configuration items | ||
CONFIG_ITEMS = { | ||
"pr_review_inline": "PR Review Inline Enabled", | ||
} | ||
|
||
# Configuration file paths | ||
GLOBAL_CONFIG_PATH = os.path.join(os.path.expanduser("~"), ".chat", ".workflow_config.json") | ||
|
||
|
||
def read_config(config_path, item): | ||
if os.path.exists(config_path): | ||
with open(config_path, "r", encoding="utf-8") as f: | ||
config = json.load(f) | ||
return config.get(item) | ||
return None | ||
|
||
|
||
def save_config(config_path, item, value): | ||
if os.path.exists(config_path): | ||
with open(config_path, "r", encoding="utf-8") as f: | ||
config = json.load(f) | ||
else: | ||
config = {} | ||
|
||
config[item] = value | ||
with open(config_path, "w", encoding="utf-8") as f: | ||
json.dump(config, f, indent=4) | ||
|
||
|
||
def is_pre_review_inline_enabled(current_value=False): | ||
print("\n\nEnable PR Review Inline:\n\n") | ||
checkbox = Checkbox( | ||
[ | ||
"PR Review Inline Enabled", | ||
], | ||
[current_value], | ||
) | ||
checkbox.render() | ||
|
||
print(f"\n\ncheckbox.selections: {checkbox.selections}\n\n") | ||
if len(checkbox.selections) > 0: | ||
return True | ||
if checkbox.selections is None: | ||
return None | ||
return False | ||
|
||
|
||
def main(): | ||
print("Starting configuration of workflow settings...", end="\n\n", flush=True) | ||
print( | ||
"If you want to change access token or host url, " | ||
"please edit the configuration file directly." | ||
) | ||
print("Configuration file is located at:", GLOBAL_CONFIG_PATH, end="\n\n", flush=True) | ||
|
||
pr_review_inline_enable = read_config(GLOBAL_CONFIG_PATH, "pr_review_inline") | ||
|
||
pr_review_inline_enable = is_pre_review_inline_enabled(pr_review_inline_enable or False) | ||
if pr_review_inline_enable is not None: | ||
save_config(GLOBAL_CONFIG_PATH, "pr_review_inline", pr_review_inline_enable) | ||
print("Workflow settings configuration successful.") | ||
sys.exit(0) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
description: 'Config required settings for GIT workflows.' | ||
steps: | ||
- run: $devchat_python $command_path/command.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
git+https://gitee.com/imlaji/pr-agent.git@main | ||
git+https://gitee.com/imlaji/pr-agent.git@ad276e206c7e462a689996ee3ada2769b35d5625 | ||
git+https://gitee.com/devchat-ai/devchat.git@main |