Skip to content

Commit 5675797

Browse files
committed
search for the TL;DR comment from the back of the sorted list
1 parent 2a17a7a commit 5675797

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/rust-project-goals-cli-llm/src/updates.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ fn tldr(
162162
_issue_id: &IssueId,
163163
comments: &mut Vec<ExistingGithubComment>,
164164
) -> anyhow::Result<Option<String>> {
165-
let Some(index) = comments.iter().position(|c| c.body.starts_with(TLDR)) else {
165+
// `comments` are sorted by creation date in an ascending order, so we look for the most recent
166+
// TL;DR comment from the end.
167+
let Some(index) = comments.iter().rposition(|c| c.body.starts_with(TLDR)) else {
166168
return Ok(None);
167169
};
168170

0 commit comments

Comments
 (0)