Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Issue PR reminder workflow created #763

Merged
merged 10 commits into from
Feb 20, 2025

Conversation

csehatt741
Copy link
Contributor

@csehatt741 csehatt741 commented Feb 17, 2025

User description

Description

  • Issue PR Reminder workflow created to create PR reminder comments on issues for assignees, who haven't opened a PR longer than a defined period of time
  • Issue Unassign workflow created to unassign users, who haven't opened a PR longer than a defined period of time
  • PR Review Reminder workflow created to create review reminder comments on PRs for users, who haven't resolved change requests longer than a defined period of time
  • PR Close workflow created to close PRs, which has unresolved change requests longer than a defined period of time
  • Auto-assign issue on /attempt comment workflow updated to create an issue comment, when user has reached their maximum number of concurrent issues

Fixes #497

Developer's checklist

  • My PR follows the style guidelines of this project
  • I have performed a self-check on my work

If changes are made in the code:

  • I have followed the coding guidelines
  • My changes in code generate no new warnings
  • My changes are breaking another fix/feature of the project
  • I have added test cases to show that my feature works
  • I have added relevant screenshots in my PR
  • There are no UI/UX issues

Documentation Update

  • This PR requires an update to the documentation at docs.keyshade.xyz
  • I have made the necessary updates to the documentation, or no documentation changes are required.

PR Type

Enhancement, Tests


Description

  • Introduced workflows for automated issue and PR management.

  • Added limits on concurrent issues per user in auto-assign.yaml.

  • Implemented reminders for PR creation and review in separate workflows.

  • Automated unassignment and closure of inactive issues and PRs.


Changes walkthrough 📝

Relevant files
Enhancement
auto-assign.yaml
Enforce user issue limits and enhance `/attempt` command 

.github/workflows/auto-assign.yaml

  • Added logic to enforce maximum concurrent issues per user.
  • Introduced functions to list issue events and user open issues.
  • Updated /attempt command to handle assignment limits and
    notifications.
  • +96/-19 
    issue-pr-reminder.yaml
    Workflow for reminding users to create PRs                             

    .github/workflows/issue-pr-reminder.yaml

  • Created workflow to remind users to create PRs.
  • Added logic to check for draft PRs and send reminders.
  • Configured reminders for initial and final warnings.
  • +173/-0 
    issue-unassign.yaml
    Workflow to unassign inactive issue assignees                       

    .github/workflows/issue-unassign.yaml

  • Added workflow to unassign inactive users from issues.
  • Implemented logic to check issue assignment duration.
  • Automated unassignment and notification for inactivity.
  • +124/-0 
    pr-close.yaml
    Workflow to close inactive pull requests                                 

    .github/workflows/pr-close.yaml

  • Created workflow to close inactive PRs.
  • Added logic to check for unresolved reviews.
  • Automated PR closure and notification for inactivity.
  • +116/-0 
    pr-review-reminder.yaml
    Workflow to remind users of pending PR reviews                     

    .github/workflows/pr-review-reminder.yaml

  • Added workflow to remind users to resolve PR reviews.
  • Configured reminders for initial and final warnings.
  • Automated notifications for unresolved reviews.
  • +164/-0 

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @csehatt741 csehatt741 force-pushed the issue-assignment-bot branch 4 times, most recently from 34ef341 to f2cb620 Compare February 19, 2025 09:11
    @csehatt741 csehatt741 marked this pull request as ready for review February 19, 2025 09:22
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🎫 Ticket compliance analysis ✅

    497 - Fully compliant

    Compliant requirements:

    • Issue Already Assigned Notification: Bot notifies when issue is already assigned
    • Reminder to Current Assignee: Bot prompts for PR creation
    • Multiple PR Restriction: Bot enforces maximum concurrent issues per user
    • Unassign inactive users automatically after defined period
    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    String Interpolation Bug

    The template literals for user notifications use single quotes which will prevent proper string interpolation of variables

    body: '@${comment.user.login}, cannot concurrently work on more than ${userMaxConcurrentIssueCount} issues. Tag a maintainer if you need to take over.',
    Variable Reference Error

    The variable issueAssignedAt is undefined and will cause runtime errors when creating review reminders

    const closePrAfter = new Date(issueAssignedAt.getTime() + closePrAfterMilliseconds);
    const createFinalReviewReminderAfter = new Date(issueAssignedAt.getTime() + closePrAfterMilliseconds - createReviewReminderBeforePrClosedMilliseconds);

    Copy link
    Contributor

    codiumai-pr-agent-free bot commented Feb 19, 2025

    PR Code Suggestions ✨

    Latest suggestions up to e9e9b10

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix incorrect variable reference
    Suggestion Impact:Changed variable reference from issueAssignedAt to pullRequestCreatedAt in date calculations

    code diff:

    -                const closePrAfter = new Date(issueAssignedAt.getTime() + closePrAfterMilliseconds);
    -                const createFinalReviewReminderAfter = new Date(issueAssignedAt.getTime() + closePrAfterMilliseconds - createReviewReminderBeforePrClosedMilliseconds);
    +                const closePrAfter = new Date(pullRequestCreatedAt.getTime() + closePrAfterMilliseconds);
    +                const createFinalReviewReminderAfter = new Date(pullRequestCreatedAt.getTime() + closePrAfterMilliseconds - createReviewReminderBeforePrClosedMilliseconds);

    Fix incorrect variable reference - issueAssignedAt should be
    pullRequestCreatedAt since we're dealing with PRs not issues

    .github/workflows/pr-review-reminder.yaml [155-156]

    -const closePrAfter = new Date(issueAssignedAt.getTime() + closePrAfterMilliseconds);
    -const createFinalReviewReminderAfter = new Date(issueAssignedAt.getTime() + closePrAfterMilliseconds - createReviewReminderBeforePrClosedMilliseconds);
    +const closePrAfter = new Date(pullRequestCreatedAt.getTime() + closePrAfterMilliseconds);
    +const createFinalReviewReminderAfter = new Date(pullRequestCreatedAt.getTime() + closePrAfterMilliseconds - createReviewReminderBeforePrClosedMilliseconds);

    [Suggestion has been applied]

    Suggestion importance[1-10]: 10

    __

    Why: Critical bug fix - using undefined variable 'issueAssignedAt' would cause runtime errors. The correct variable 'pullRequestCreatedAt' is already defined and should be used since we're dealing with PRs.

    High
    Fix string interpolation syntax
    Suggestion Impact:Changed string interpolation syntax from single quotes to backticks in two comment messages

    code diff:

    -                    body: '@${comment.user.login}, cannot concurrently work on more than ${userMaxConcurrentIssueCount} issues. Tag a maintainer if you need to take over.',
    +                    body: `@${comment.user.login}, cannot concurrently work on more than ${userMaxConcurrentIssueCount} issues. Tag a maintainer if you need to take over.`,
                       });
                     }
                   } else {
    @@ -149,7 +149,7 @@
                       owner,
                       repo,
                       issue_number: issue.number,
    -                  body: '@${comment.user.login}, this issue is already assigned. Tag a maintainer if you need to take over.',
    +                  body: `@${comment.user.login}, this issue is already assigned. Tag a maintainer if you need to take over.`,

    Fix template string syntax - use backticks instead of single quotes for string
    interpolation

    .github/workflows/auto-assign.yaml [144]

    -body: '@${comment.user.login}, cannot concurrently work on more than ${userMaxConcurrentIssueCount} issues. Tag a maintainer if you need to take over.',
    +body: `@${comment.user.login}, cannot concurrently work on more than ${userMaxConcurrentIssueCount} issues. Tag a maintainer if you need to take over.`,

    [Suggestion has been applied]

    Suggestion importance[1-10]: 8

    __

    Why: Important bug fix - current syntax using single quotes won't interpolate variables, leading to literal '@${comment.user.login}' in the message instead of the actual username.

    Medium
    • Update

    Previous suggestions

    ✅ Suggestions up to commit 0e37df8
    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix undefined variable reference
    Suggestion Impact:The commit directly implemented the suggested change by replacing issueAssignedAt with pullRequestCreatedAt in the date calculations

    code diff:

    -                const closePrAfter = new Date(issueAssignedAt.getTime() + closePrAfterMilliseconds);
    -                const createFinalReviewReminderAfter = new Date(issueAssignedAt.getTime() + closePrAfterMilliseconds - createReviewReminderBeforePrClosedMilliseconds);
    +                const closePrAfter = new Date(pullRequestCreatedAt.getTime() + closePrAfterMilliseconds);
    +                const createFinalReviewReminderAfter = new Date(pullRequestCreatedAt.getTime() + closePrAfterMilliseconds - createReviewReminderBeforePrClosedMilliseconds);

    Fix incorrect variable reference. Using 'issueAssignedAt' which is undefined -
    should be 'pullRequestCreatedAt'.

    .github/workflows/pr-review-reminder.yaml [156-157]

    -const closePrAfter = new Date(issueAssignedAt.getTime() + closePrAfterMilliseconds);
    -const createFinalReviewReminderAfter = new Date(issueAssignedAt.getTime() + closePrAfterMilliseconds - createReviewReminderBeforePrClosedMilliseconds);
    +const closePrAfter = new Date(pullRequestCreatedAt.getTime() + closePrAfterMilliseconds);
    +const createFinalReviewReminderAfter = new Date(pullRequestCreatedAt.getTime() + closePrAfterMilliseconds - createReviewReminderBeforePrClosedMilliseconds);
    Suggestion importance[1-10]: 10

    __

    Why: Critical bug fix - code references undefined variable 'issueAssignedAt' which would cause runtime errors. Should use 'pullRequestCreatedAt' which is the correct variable defined in the context.

    High
    Fix string template syntax

    Fix template literal syntax in error message strings. Currently using single
    quotes which prevents variable interpolation.

    .github/workflows/auto-assign.yaml [144]

    -body: '@${comment.user.login}, cannot concurrently work on more than ${userMaxConcurrentIssueCount} issues. Tag a maintainer if you need to take over.',
    +body: `@${comment.user.login}, cannot concurrently work on more than ${userMaxConcurrentIssueCount} issues. Tag a maintainer if you need to take over.`,

    [Suggestion has been applied]

    Suggestion importance[1-10]: 9

    __

    Why: Critical bug fix - current code uses single quotes which prevents JavaScript template literal interpolation, causing the variables to be displayed literally instead of their values in the error message.

    High

    @rajdip-b rajdip-b merged commit 7667ebd into keyshade-xyz:develop Feb 20, 2025
    3 checks passed
    @csehatt741 csehatt741 deleted the issue-assignment-bot branch February 20, 2025 06:32
    rajdip-b pushed a commit that referenced this pull request Feb 20, 2025
    ## [2.12.0-stage.9](v2.12.0-stage.8...v2.12.0-stage.9) (2025-02-20)
    
    ### 🚀 Features
    
    * **platform:** Add copy slug functionality to variable card context menu ([#769](#769)) ([d252668](d252668))
    
    ### 🔧 Miscellaneous Chores
    
    * Issue PR reminder workflow created ([#763](#763)) ([7667ebd](7667ebd))
    @rajdip-b
    Copy link
    Member

    🎉 This PR is included in version 2.12.0-stage.9 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    GitHub Action Bot Behaviour for Issue Assignment and Multiple PR Handling
    2 participants