Skip to content

Conversation

@aniket866
Copy link
Contributor

@aniket866 aniket866 commented Feb 4, 2026

Edit: by mistake raised against main Closing

@aniket866 aniket866 requested a review from a team as a code owner February 4, 2026 21:33
@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

Two new GitHub Actions workflows are introduced: one automatically detects duplicate issues via similarity analysis and optionally applies a "duplicate" label, while the other validates that pull requests are properly linked to issues and their authors are assigned to those issues.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
.github/workflows/duplicate_issue_detector.yaml, .github/workflows/pr_assignment_validation.yaml
Introduces automated issue deduplication via similarity scoring and comment feedback, plus PR validation requiring proper issue linkage and author assignment with labeling for non-compliant PRs.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub as GitHub Events
    participant Similarity as Similarity Analysis
    participant Script as GitHub Script
    participant API as GitHub API

    User->>GitHub: Open/Edit Issue
    GitHub->>Similarity: Trigger Duplicate Check
    Similarity->>API: Retrieve Similar Issues
    API-->>Similarity: Return Similarity Results
    Similarity->>Script: Pass Analysis Scores
    Script->>API: Post Comment (if similar found)
    API-->>GitHub: Comment Added
    alt High Confidence Match (score ≥ 80%)
        Script->>API: Add "duplicate" Label
        API-->>GitHub: Label Applied
    end
Loading
sequenceDiagram
    participant User
    participant GitHub as GitHub Events
    participant Script as GitHub Script
    participant API as GitHub API

    User->>GitHub: Open/Reopen/Edit PR
    GitHub->>Script: Trigger Assignment Validation
    
    alt Already Labeled "not-assigned"
        Script->>Script: Skip Processing
    else Continue Validation
        Script->>Script: Parse PR Body for Linked Issues
        alt No Linked Issues Found
            Script->>API: Post Comment
            Script->>API: Add "not-assigned" Label
            API-->>GitHub: Updates Applied
        else Linked Issues Found
            Script->>API: Fetch Each Linked Issue
            API-->>Script: Return Issue & Assignees
            Script->>Script: Check if PR Author is Assigned
            alt Author Assigned to Issue
                Script->>Script: PR Valid
            else Author Not Assigned
                Script->>API: Post Comment
                Script->>API: Add "not-assigned" Label
                API-->>GitHub: Updates Applied
            end
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • M4dhav

Poem

🐰 A duplicate detector hops so keen,
Finding twins that once were unseen!
Pull requests now checked with care divine,
Assignments verified down the line! ✨🔍

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes a second workflow (pr_assignment_validation.yaml) for PR validation that is not mentioned in the linked issue #216, which focuses solely on duplicate issue detection. Either remove the PR assignment validation workflow or link it to an appropriate issue, or update issue #216 to document both features as part of this PR's scope.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Duplicate issue and pr validator' broadly references the PR changes but is somewhat vague regarding the actual implementation—it mentions 'pr validator' when the PR only adds duplicate issue detection and PR assignment validation workflows.
Linked Issues check ✅ Passed The PR implements the core requirements from issue #216: automatic duplicate issue detection using a GitHub Action, similarity analysis with configurable thresholds, and labeling as 'duplicate' without auto-closing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @.github/workflows/duplicate_issue_detector.yaml:
- Around line 42-44: The condition is doing a lexicographic string comparison
for highest-similarity-score; change it to a numeric comparison by converting
the output to a number and comparing to an unquoted numeric literal. Replace the
second clause to use fromJSON(steps.similarity.outputs.highest-similarity-score)
>= 80 so the combined condition reads:
steps.similarity.outputs.similar-issues-found == 'true' &&
fromJSON(steps.similarity.outputs.highest-similarity-score) >= 80, referencing
the steps.similarity.outputs.highest-similarity-score symbol to locate the code.
- Line 45: Replace the outdated action reference "actions/github-script@v6" with
the current stable version "actions/github-script@v8"; update the workflow step
that uses actions/github-script (the line containing uses:
actions/github-script@v6) to uses: actions/github-script@v8 so the workflow runs
the newer, security- and compatibility-improved release.

In @.github/workflows/pr_assignment_validation.yaml:
- Around line 52-72: The current loop over matches calling
github.rest.issues.get (using issueNumber) doesn't handle the case where all
fetches fail; add a success flag or counter in the scope outside the for (const
match of matches) loop that is set when any issue fetch succeeds and is
processed (e.g., when you compute assignees from issue.data.assignees and check
assignees.includes(author)); after the loop, check that flag and if no fetch
succeeded, log a distinct message and avoid/alter applying the `not-assigned`
label (or add a separate `issues-unreachable` label) so the workflow treats "all
fetches failed" differently from "author not assigned".
🧹 Nitpick comments (2)
.github/workflows/pr_assignment_validation.yaml (2)

31-33: Regex may miss common linking patterns.

The current regex only matches fixes, closes, resolves (with trailing 's'). GitHub also recognizes singular forms and past tense:

  • fix #123, `close `#123, resolve #123``
  • fixed #123, `closed `#123, resolved #123``
Proposed fix to support more patterns
             // Match Fixes `#123` / Closes `#123` / Resolves `#123`
-            const issueRegex = /(fixes|closes|resolves)\s+#(\d+)/gi;
+            const issueRegex = /(fix|fixes|fixed|close|closes|closed|resolve|resolves|resolved)\s+#(\d+)/gi;
             const matches = [...body.matchAll(issueRegex)];

69-71: Silent error handling may obscure issues.

The catch block logs failures but doesn't distinguish between expected errors (e.g., issue doesn't exist, cross-repo reference) and unexpected errors (e.g., rate limiting, auth issues). Consider logging the error details for easier debugging:

Proposed improvement
               } catch (e) {
-                console.log(`Failed to fetch issue #${issueNumber}`);
+                console.log(`Failed to fetch issue #${issueNumber}: ${e.message}`);
               }

if: |
steps.similarity.outputs.similar-issues-found == 'true' &&
steps.similarity.outputs.highest-similarity-score >= '80'
uses: actions/github-script@v6
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

latest version actions/github-script GitHub Action

💡 Result:

The latest release of actions/github-script is v8.0.0, and the recommended major-version tag to use in workflows is actions/github-script@v8. [1][2]


Update actions/github-script to v8.

The current version actions/github-script@v6 is outdated. The latest stable version is v8, which includes compatibility and security improvements. Update to actions/github-script@v8.

🧰 Tools
🪛 actionlint (1.7.10)

[error] 45-45: the runner of "actions/github-script@v6" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
In @.github/workflows/duplicate_issue_detector.yaml at line 45, Replace the
outdated action reference "actions/github-script@v6" with the current stable
version "actions/github-script@v8"; update the workflow step that uses
actions/github-script (the line containing uses: actions/github-script@v6) to
uses: actions/github-script@v8 so the workflow runs the newer, security- and
compatibility-improved release.

Comment on lines +52 to +72
for (const match of matches) {
const issueNumber = match[2];

try {
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber
});

const assignees = issue.data.assignees.map(a => a.login);

// Valid only if PR author is assigned
if (assignees.includes(author)) {
console.log('Author is assigned. PR is valid.');
return;
}
} catch (e) {
console.log(`Failed to fetch issue #${issueNumber}`);
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Consider edge case: all issue fetches fail.

If every linked issue fails to fetch (e.g., all referenced issues were deleted or are in other repos), the workflow falls through and labels the PR as not-assigned. This may be unexpected behavior for the PR author. Consider adding explicit handling or a distinct message for this scenario.

🤖 Prompt for AI Agents
In @.github/workflows/pr_assignment_validation.yaml around lines 52 - 72, The
current loop over matches calling github.rest.issues.get (using issueNumber)
doesn't handle the case where all fetches fail; add a success flag or counter in
the scope outside the for (const match of matches) loop that is set when any
issue fetch succeeds and is processed (e.g., when you compute assignees from
issue.data.assignees and check assignees.includes(author)); after the loop,
check that flag and if no fetch succeeded, log a distinct message and
avoid/alter applying the `not-assigned` label (or add a separate
`issues-unreachable` label) so the workflow treats "all fetches failed"
differently from "author not assigned".

@aniket866 aniket866 closed this Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant