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

#πŸš€ Bounty Bot Enhancement: Fixed Label Updates & Slack Integration #3809

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rishyym0927
Copy link

@rishyym0927 rishyym0927 commented Mar 4, 2025

User description

πŸ›  Changes Introduced:

βœ… Implemented bounty tracking to update the existing bounty label instead of adding duplicates.
βœ… Improved GitHub issue comments to update the existing bounty message instead of creating multiple comments.
βœ… Sponsorship history tracking: Each user’s total sponsored developers count is tracked and displayed.
βœ… Replaced SLACK_WEBHOOK_URL with SLACK_BOT_TOKEN for better Slack integration.
βœ… Improved Slack notifications to reflect the updated bounty amount.

πŸ”₯ How It Works:

  • A user comments /bounty $X on an issue.
  • The bot updates the issue label to reflect the total bounty.
  • The bot updates the GitHub comment instead of adding duplicate messages.
  • The bot tracks the number of developers the user has sponsored.
  • A Slack message is sent to notify about the bounty.

πŸ” Testing Done:

βœ” Verified that bounties are correctly updated.
βœ” Tested Slack notifications for accuracy.
βœ” Ensured the GitHub comment updates correctly.

###Changes Made
-You need to manually add the SLACK_BOT_TOKEN and PERSONAL_ACCESS_TOKENS in secrets under actions

###Screenshots
image
image


πŸ“Œ Closes #3767


PR Type

Enhancement, Tests


Description

  • Implemented GitHub Action to handle /bounty $X comments.

  • Added Slackbot integration for bounty notifications.

  • Tracks user sponsorship history and updates GitHub issue labels.

  • Configured GitHub workflow for automated bounty processing.


Changes walkthrough πŸ“

Relevant files
Enhancement
bounty.mjs
Implement GitHub Action for bounty processingΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β 

.github/scripts/bounty.mjs

  • Added script to process /bounty $X GitHub comments.
  • Updates or creates bounty labels on GitHub issues.
  • Posts Slack notifications for bounty updates.
  • Tracks user sponsorship history and updates GitHub comments.
  • +137/-0Β 
    Configuration changes
    bounty.yml
    Add GitHub workflow for bounty bot automationΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β 

    .github/workflows/bounty.yml

  • Created GitHub workflow to trigger on issue comments.
  • Configured Node.js environment and dependencies.
  • Executes bounty processing script with required secrets.
  • +35/-0Β  Β 

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • Copy link
    Contributor

    github-actions bot commented Mar 4, 2025

    PR Reviewer Guide πŸ”

    Here are some key observations to aid the review process:

    🎫 Ticket compliance analysis πŸ”Ά

    3767 - Partially compliant

    Compliant requirements:

    • When a user comments /bounty $X on a GitHub issue, add or update a $X Bounty label on the issue.
    • Post a comment confirming the bounty and include the total bounty amount and sponsorship history.
    • Track the user’s sponsorship history (e.g., total number of developers they have sponsored).
    • If a bounty already exists, update the total bounty amount instead of adding multiple labels.
    • Slackbot should confirm the action and post a message with the updated bounty amount.

    Non-compliant requirements:

    Requires further human verification:

    • Verify the Slackbot integration works as expected in a real Slack environment.
    • Confirm the GitHub Action behaves correctly in a live repository with multiple bounty updates.
    ⏱️ Estimated effort to review: 4 πŸ”΅πŸ”΅πŸ”΅πŸ”΅βšͺ
    πŸ§ͺΒ No relevant tests
    πŸ”’Β Security concerns

    Sensitive information exposure:
    The PERSONAL_ACCESS_TOKEN and SLACK_BOT_TOKEN are used in the script. Ensure these secrets are securely stored and not logged or exposed in any way.

    ⚑ Recommended focus areas for review

    Possible Error Handling Gap

    The error handling for Slack notifications and GitHub API calls logs errors but does not provide a fallback or retry mechanism. This could lead to missed updates or notifications.

    try {
        await slack.chat.postMessage({
            channel: '#bounty-alerts',
            text: `πŸš€ *Bounty Alert!*\n@${commenter} has added a *$${bountyAmount}* bounty to <https://github.com/${repository.full_name}/issues/${issueNumber}|#${issueNumber}>.\nThe total bounty for this issue is now *$${totalBounty}*.\nContribute now and earn rewards!`
        });
    } catch (slackError) {
        console.error('Slack Notification Error:', slackError);
    }
    Sponsorship History Persistence

    The sponsorshipHistory object is defined locally within the script and does not persist across runs, which may lead to inaccurate sponsorship tracking.

    const sponsorshipHistory = {};
    if (!sponsorshipHistory[commenter]) {
        sponsorshipHistory[commenter] = 1;
    } else {
        sponsorshipHistory[commenter] += 1;
    }

    Copy link
    Contributor

    github-actions bot commented Mar 4, 2025

    PR Code Suggestions ✨

    @rishyym0927 rishyym0927 changed the title ## πŸš€ Bounty Bot Enhancement: Fixed Label Updates & Slack Integration #πŸš€ Bounty Bot Enhancement: Fixed Label Updates & Slack Integration Mar 4, 2025
    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 & Slackbot: /bounty $X Command
    1 participant