Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use commit messages in PR tools #168

Merged
merged 2 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 2023-08-02

### Enhanced
- Updated several tools in the `pr_agent` package to use commit messages in their functionality.
- Commit messages are now retrieved and stored in the `vars` dictionary for each tool.
- Added a section to display the commit messages in the prompts of various tools.
Comment on lines +1 to +6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHANGELOG.md update


## 2023-08-01
2023-08-01

Expand Down
5 changes: 5 additions & 0 deletions pr_agent/settings/pr_code_suggestions_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ Description: '{{description}}'
{%- if language %}
Main language: {{language}}
{%- endif %}
{%- if commit_messages_str %}
Commit messages:
{{commit_messages_str}}
{%- endif %}
The PR Diff:
Expand Down
5 changes: 5 additions & 0 deletions pr_agent/settings/pr_information_from_user_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ Description: '{{description}}'
{%- if language %}
Main language: {{language}}
{%- endif %}
{%- if commit_messages_str %}
Commit messages:
{{commit_messages_str}}
{%- endif %}
The PR Git Diff:
Expand Down
5 changes: 5 additions & 0 deletions pr_agent/settings/pr_questions_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ Description: '{{description}}'
{%- if language %}
Main language: {{language}}
{%- endif %}
{%- if commit_messages_str %}
Commit messages:
{{commit_messages_str}}
{%- endif %}
The PR Git Diff:
Expand Down
5 changes: 5 additions & 0 deletions pr_agent/settings/pr_reviewer_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ Description: '{{description}}'
{%- if language %}
Main language: {{language}}
{%- endif %}
{%- if commit_messages_str %}
Commit messages:
{{commit_messages_str}}
{%- endif %}
{%- if question_str %}
######
Expand Down
5 changes: 5 additions & 0 deletions pr_agent/settings/pr_update_changelog_prompts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ Description: '{{description}}'
{%- if language %}
Main language: {{language}}
{%- endif %}
{%- if commit_messages_str %}
Commit messages:
{{commit_messages_str}}
{%- endif %}
The PR Diff:
Expand Down
1 change: 1 addition & 0 deletions pr_agent/tools/pr_code_suggestions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(self, pr_url: str, cli_mode=False, args: list = None):
"diff": "", # empty diff for initial calculation
"num_code_suggestions": get_settings().pr_code_suggestions.num_code_suggestions,
"extra_instructions": get_settings().pr_code_suggestions.extra_instructions,
"commit_messages_str": self.git_provider.get_commit_messages(),
mrT23 marked this conversation as resolved.
Show resolved Hide resolved
}
self.token_handler = TokenHandler(self.git_provider.pr,
self.vars,
Expand Down
3 changes: 1 addition & 2 deletions pr_agent/tools/pr_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def __init__(self, pr_url: str, args: list = None):
self.main_pr_language = get_main_pr_language(
self.git_provider.get_languages(), self.git_provider.get_files()
)
commit_messages_str = self.git_provider.get_commit_messages()

# Initialize the AI handler
self.ai_handler = AiHandler()
Expand All @@ -40,7 +39,7 @@ def __init__(self, pr_url: str, args: list = None):
"language": self.main_pr_language,
"diff": "", # empty diff for initial calculation
"extra_instructions": get_settings().pr_description.extra_instructions,
"commit_messages_str": commit_messages_str
"commit_messages_str": self.git_provider.get_commit_messages()
mrT23 marked this conversation as resolved.
Show resolved Hide resolved
}

# Initialize the token handler
Expand Down
1 change: 1 addition & 0 deletions pr_agent/tools/pr_information_from_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, pr_url: str, args: list = None):
"description": self.git_provider.get_pr_description(),
"language": self.main_pr_language,
"diff": "", # empty diff for initial calculation
"commit_messages_str": self.git_provider.get_commit_messages(),
mrT23 marked this conversation as resolved.
Show resolved Hide resolved
}
self.token_handler = TokenHandler(self.git_provider.pr,
self.vars,
Expand Down
1 change: 1 addition & 0 deletions pr_agent/tools/pr_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(self, pr_url: str, args=None):
"language": self.main_pr_language,
"diff": "", # empty diff for initial calculation
"questions": self.question_str,
"commit_messages_str": self.git_provider.get_commit_messages(),
mrT23 marked this conversation as resolved.
Show resolved Hide resolved
}
self.token_handler = TokenHandler(self.git_provider.pr,
self.vars,
Expand Down
1 change: 1 addition & 0 deletions pr_agent/tools/pr_reviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def __init__(self, pr_url: str, is_answer: bool = False, args: list = None):
'question_str': question_str,
'answer_str': answer_str,
"extra_instructions": get_settings().pr_reviewer.extra_instructions,
"commit_messages_str": self.git_provider.get_commit_messages(),
}

self.token_handler = TokenHandler(
Expand Down
1 change: 1 addition & 0 deletions pr_agent/tools/pr_update_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(self, pr_url: str, cli_mode=False, args=None):
"changelog_file_str": self.changelog_file_str,
"today": date.today(),
"extra_instructions": get_settings().pr_update_changelog.extra_instructions,
"commit_messages_str": self.git_provider.get_commit_messages(),
}
self.token_handler = TokenHandler(self.git_provider.pr,
self.vars,
Expand Down