Add Duplicate Issue Detector workflow#310
Conversation
WalkthroughA new GitHub Actions workflow is added that detects potential duplicate issues when an issue is opened or edited by analyzing content against the past 365 days of issues, posting a comment and applying a Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub as GitHub Events
participant Actions as GitHub Actions Runner
participant Analyzer as issues-similarity-analysis
participant Repo as Repository Issues
GitHub->>Actions: issue opened/edited event
Actions->>Analyzer: run analysis (token, 365d, threshold 0.65, exclude terms)
Analyzer->>Repo: query recent issues (365 days)
Analyzer->>Analyzer: compute similarity scores
alt potential duplicates found
Analyzer->>Repo: post comment "### 🤖 Potential Duplicate Issues Detected"
Analyzer->>Repo: apply `duplicate` label
else no duplicates
Analyzer->>Repo: no action
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/duplicate_issue_detector.yml:
- Line 15: The workflow currently references the third-party action as
actions-cool/issues-similarity-analysis@v1 which is mutable; replace that tag
with a pinned immutable commit SHA (full 40-character commit hash) for the
actions-cool/issues-similarity-analysis repository to remove supply-chain
risk—locate the uses: entry referencing
actions-cool/issues-similarity-analysis@v1 in the workflow and update it to
actions-cool/issues-similarity-analysis@<commit-sha> after verifying the desired
commit in the action repo; record or document the chosen SHA so future updates
can be intentional and auditable.
- Line 5: The workflow currently triggers on both "opened" and "edited" (the
line with types: [opened, edited]) causing the
actions-cool/issues-similarity-analysis job to post duplicate comments on issue
edits; fix by removing "edited" from the types array so it only runs on
"opened", or add a concurrency block to the workflow that groups by the issue
identifier (e.g., using github.event.issue.number) with cancel-in-progress: true
to prevent parallel/duplicate runs for the same issue.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: e66f9cad-68ab-4a9a-81fa-6838c3042ce8
📒 Files selected for processing (1)
.github/workflows/duplicate_issue_detector.yml
There was a problem hiding this comment.
♻️ Duplicate comments (1)
.github/workflows/duplicate_issue_detector.yml (1)
5-5:⚠️ Potential issue | 🟡 MinorAvoid repeated bot runs on issue edits unless intentionally required.
At Line [5],
editedcauses the workflow to run on every issue modification, which can repeatedly post/update duplicate-detection output and labels for the same issue. Preferopenedonly, or keepeditedwithconcurrencykeyed by issue number.Suggested change (keep edited, prevent overlapping duplicate runs)
name: Duplicate Issue Detector on: issues: types: [opened, edited] +concurrency: + group: duplicate-issue-${{ github.event.issue.number }} + cancel-in-progress: true + jobs: duplicate-issues:Does actions-cool/issues-similarity-analysis deduplicate or suppress repeated comments when the same issue triggers multiple runs (e.g., opened + edited)?🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/duplicate_issue_detector.yml at line 5, The workflow currently triggers on types: [opened, edited], which causes duplicate runs on every issue edit; either remove "edited" from the types array to only run on opened events, or keep "edited" but add a concurrency block (e.g., concurrency: { group: "duplicate-issue-detector-${{ github.event.issue.number }}", cancel-in-progress: true }) to ensure only one run per issue is active and prevent repeated duplicate-detection comments/labels; update the types array or add the concurrency section accordingly and ensure the group uses github.event.issue.number to scope per-issue.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In @.github/workflows/duplicate_issue_detector.yml:
- Line 5: The workflow currently triggers on types: [opened, edited], which
causes duplicate runs on every issue edit; either remove "edited" from the types
array to only run on opened events, or keep "edited" but add a concurrency block
(e.g., concurrency: { group: "duplicate-issue-detector-${{
github.event.issue.number }}", cancel-in-progress: true }) to ensure only one
run per issue is active and prevent repeated duplicate-detection
comments/labels; update the types array or add the concurrency section
accordingly and ensure the group uses github.event.issue.number to scope
per-issue.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 2738b424-a20f-4d74-93eb-456a903ef3e9
📒 Files selected for processing (1)
.github/workflows/duplicate_issue_detector.yml
|
name: Duplicate Issue Detector on: jobs: Fixed! Pinned the action to the immutable commit SHA 0a5ea211e6a178915f0f754968fc94ff845bcb41 # v1 to prevent supply-chain risk. |
📝 Description
🔧 Changes Made
✅ Checklist
Summary by CodeRabbit