Skip to content

Commit c6a241e

Browse files
ci: prevent duplicate PR check from flagging current PR as duplicate (anomalyco#6924)
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
1 parent 4b7301e commit c6a241e

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

.github/workflows/duplicate-prs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
{
4545
echo "Check for duplicate PRs related to this new PR:"
4646
echo ""
47+
echo "CURRENT_PR_NUMBER: $PR_NUMBER"
48+
echo ""
4749
echo "Title: $(gh pr view "$PR_NUMBER" --json title --jq .title)"
4850
echo ""
4951
echo "Description:"

.opencode/agent/duplicate-pr.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ You are a duplicate PR detection agent. When a PR is opened, your job is to sear
1212

1313
Use the github-pr-search tool to search for PRs that might be addressing the same issue or feature.
1414

15+
IMPORTANT: The input will contain a line `CURRENT_PR_NUMBER: NNNN`. This is the current PR number, you should not mark that the current PR as a duplicate of itself.
16+
1517
Search using keywords from the PR title and description. Try multiple searches with different relevant terms.
1618

1719
If you find potential duplicates:

.opencode/tool/github-pr-search.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ export default tool({
4545
}
4646

4747
const prs = result.items as PR[]
48+
49+
if (prs.length === 0) {
50+
return `No other PRs found matching "${args.query}"`
51+
}
52+
4853
const formatted = prs.map((pr) => `${pr.title}\n${pr.html_url}`).join("\n\n")
4954

5055
return `Found ${result.total_count} PRs (showing ${prs.length}):\n\n${formatted}`

0 commit comments

Comments
 (0)