Skip to content

Commit c9debc3

Browse files
authored
Merge pull request qodo-ai#499 from Codium-ai/tr/describe_message
final update message in PR description
2 parents c21e606 + fe7d2bb commit c9debc3

File tree

7 files changed

+13
-2
lines changed

7 files changed

+13
-2
lines changed

docs/DESCRIBE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Under the section 'pr_description', the [configuration file](./../pr_agent/setti
2828
- `extra_instructions`: Optional extra instructions to the tool. For example: "focus on the changes in the file X. Ignore change in ...".
2929
- To enable `custom labels`, apply the configuration changes described [here](./GENERATE_CUSTOM_LABELS.md#configuration-changes)
3030
- `enable_pr_type`: if set to false, it will not show the `PR type` as a text value in the description content. Default is true.
31+
- `final_update_message`: if set to true, it will add a comment message [`PR Description updated to latest commit...`](https://github.com/Codium-ai/pr-agent/pull/499#issuecomment-1837412176) after finishing calling `/describe`. Default is true.
3132

3233
### Markers template
3334

pr_agent/git_providers/codecommit_provider.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def __init__(self, pr_url: Optional[str] = None, incremental: Optional[bool] = F
6161
self.pr = None
6262
self.diff_files = None
6363
self.git_files = None
64+
self.pr_url = pr_url
6465
if pr_url:
6566
self.set_pr(pr_url)
6667

pr_agent/git_providers/gerrit_provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def __init__(self, key: str, incremental=False):
192192
)
193193
self.repo = Repo(self.repo_path)
194194
assert self.repo
195-
195+
self.pr_url = base_url
196196
self.pr = PullRequestMimic(self.get_pr_title(), self.get_diff_files())
197197

198198
def get_pr_title(self):

pr_agent/git_providers/github_provider.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def __init__(self, pr_url: Optional[str] = None, incremental=IncrementalPR(False
3131
self.diff_files = None
3232
self.git_files = None
3333
self.incremental = incremental
34+
self.pr_url = pr_url
3435
if pr_url and 'pull' in pr_url:
3536
self.set_pr(pr_url)
3637
self.last_commit_id = list(self.pr.get_commits())[-1]

pr_agent/git_providers/gitlab_provider.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def __init__(self, merge_request_url: Optional[str] = None, incremental: Optiona
3737
self.diff_files = None
3838
self.git_files = None
3939
self.temp_comments = []
40+
self.pr_url = merge_request_url
4041
self._set_merge_request(merge_request_url)
4142
self.RE_HUNK_HEADER = re.compile(
4243
r"^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@[ ]?(.*)")

pr_agent/settings/configuration.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ keep_original_user_title=false
4646
use_bullet_points=true
4747
extra_instructions = ""
4848
enable_pr_type=true
49+
final_update_message = true
4950

5051
# markers
5152
use_description_markers=false

pr_agent/tools/pr_description.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,14 @@ async def run(self):
9898
if get_settings().pr_description.publish_labels and self.git_provider.is_supported("get_labels"):
9999
current_labels = self.git_provider.get_labels()
100100
user_labels = get_user_labels(current_labels)
101-
102101
self.git_provider.publish_labels(pr_labels + user_labels)
102+
103+
if (get_settings().pr_description.final_update_message and
104+
hasattr(self.git_provider, 'pr_url') and self.git_provider.pr_url):
105+
latest_commit_url = self.git_provider.get_latest_commit_url()
106+
if latest_commit_url:
107+
self.git_provider.publish_comment(
108+
f"**[PR Description]({self.git_provider.pr_url})** updated to latest commit ({latest_commit_url})")
103109
self.git_provider.remove_initial_comment()
104110
except Exception as e:
105111
get_logger().error(f"Error generating PR description {self.pr_id}: {e}")

0 commit comments

Comments
 (0)