Skip to content

Commit a68a719

Browse files
committed
fix(ci): duplicate comments prevented via issue id deduplication (#3449)
Linear sync created duplicate comments on issues when same ID appeared in both PR body and branch name. Example: ENG-8061 got two identical "Now available in stable release v0.30.4" comments 1 second apart. Root cause: IssueIDs() extracted from both PR body AND branch name, returning duplicates when both contained the same issue reference. This was exposed by commit e480400 which added stable release comments for already-released issues - before that, duplicates were silently skipped because issue was already in "Released" state. Resolves OPS-460 (cherry picked from commit cfcf45a) # Conflicts: # hack/linear-sync/main.go # hack/linear-sync/main_test.go
1 parent 10ace0e commit a68a719

File tree

2 files changed

+387
-1
lines changed

2 files changed

+387
-1
lines changed

hack/linear-sync/main.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ func run(
154154
}
155155
}
156156

157+
// Deduplicate issue IDs - same issue can appear in both PR body and branch name,
158+
// or across multiple PRs referencing the same issue
159+
releasedIssues = deduplicateIssueIDs(releasedIssues)
160+
157161
logger.Info("Found issues in pull requests", "count", len(releasedIssues))
158162

159163
linearClient := NewLinearClient(ctx, *linearToken)
@@ -189,4 +193,21 @@ func run(
189193
logger.Info("Linear sync completed", "processed", len(releasedIssues), "released", releasedCount, "skipped", skippedCount)
190194

191195
return nil
192-
}
196+
<<<<<<< HEAD
197+
}
198+
=======
199+
}
200+
201+
// deduplicateIssueIDs removes duplicate issue IDs from the slice while preserving order
202+
func deduplicateIssueIDs(issueIDs []string) []string {
203+
seen := make(map[string]bool)
204+
result := make([]string, 0, len(issueIDs))
205+
for _, id := range issueIDs {
206+
if !seen[id] {
207+
seen[id] = true
208+
result = append(result, id)
209+
}
210+
}
211+
return result
212+
}
213+
>>>>>>> cfcf45a9d (fix(ci): duplicate comments prevented via issue id deduplication (#3449))

0 commit comments

Comments
 (0)