Skip to content

Discord and GitHub bot: flows order sync based on amount of work was put into organization's public repositories - #297

Open
konard wants to merge 3 commits into
mainfrom
issue-110-9c30687a
Open

Discord and GitHub bot: flows order sync based on amount of work was put into organization's public repositories#297
konard wants to merge 3 commits into
mainfrom
issue-110-9c30687a

Conversation

@konard

@konard konard commented Sep 13, 2025

Copy link
Copy Markdown
Member

Discord and GitHub bot: flows order sync based on amount of work

This pull request implements a comprehensive flows order sync system that automatically manages Discord roles based on the amount of work contributors put into the organization's public repositories.

🎯 Problem Solved

Manually managing Discord roles for contributors based on their GitHub activity was time-consuming and inconsistent. This solution automates the process by:

  • Tracking real-time contribution metrics across all public repositories
  • Calculating work scores based on different types of contributions
  • Automatically syncing Discord roles to reflect contribution levels
  • Providing transparent leaderboards and activity reports

⚡ Key Features

📊 Contribution Tracking

  • Commits: Tracks code contributions (1.0 points each)
  • Pull Requests: Tracks major code submissions (3.0 points each)
  • Issues: Tracks problem reporting and feature requests (1.5 points each)
  • Code Reviews: Tracks peer review activities (2.0 points each)

🏆 Role Tiers

Automatic role assignment based on work scores:

  • 🥇 Contributor Legend (100+ points) - Gold role
  • 🥈 Senior Contributor (50+ points) - Purple role
  • 🥉 Active Contributor (20+ points) - Blue role
  • 🏅 Contributor (5+ points) - Green role
  • 👤 Member (0+ points) - Light grey role

🤖 Automation

  • Triggered via GitHub issues with specific keywords
  • Configurable time periods (default: 3 months)
  • Automatic Discord role synchronization
  • Contribution leaderboards posted to Discord channels

🛠 Implementation Details

Core Components

1. ContributionTrackingService

  • Aggregates activity from all public repositories
  • Calculates weighted work scores
  • Ranks contributors and assigns positions

2. DiscordRoleSyncService

  • Manages Discord bot connection and role operations
  • Automatically creates and assigns role tiers
  • Generates rich contribution reports with leaderboards

3. FlowsOrderSyncTrigger

  • GitHub issue-based trigger system
  • Configurable via issue body parameters
  • Saves contribution data for historical analysis

Configuration Options

The bot now accepts additional command-line parameters:

--discord-bot-token <token>     # Discord bot token for role sync
--enable-flows-sync <true/false> # Enable/disable flows sync functionality

Usage Example

Create a GitHub issue titled "flows order sync" with optional configuration:

months = 6
discord_token = YOUR_BOT_TOKEN
discord_guild_id = YOUR_SERVER_ID
discord_channel_id = YOUR_CHANNEL_ID
sync_roles = true

The bot will:

  1. 📈 Analyze 6 months of contribution data
  2. 🔄 Update Discord roles based on work scores
  3. 📊 Post a leaderboard to the specified Discord channel
  4. 💾 Save historical contribution data
  5. ✅ Close the issue with a status report

🧪 Testing

  • ✅ Code compiles successfully with .NET 8
  • ✅ All dependencies resolved (Discord.NET 3.15.3 added)
  • ✅ Integration with existing bot architecture
  • ✅ FileStorage compatibility for data persistence

📝 Future Enhancements

  • Web dashboard for contribution visualization
  • Configurable scoring weights per organization
  • Integration with additional Git platforms
  • Advanced metrics (code quality, review depth)
  • Notification system for role changes

🔧 Technical Notes

  • Uses Discord.NET library for Discord integration
  • Maintains backward compatibility with existing triggers
  • Follows existing codebase patterns and conventions
  • Implements proper error handling and logging
  • Stores data using the existing FileStorage system

Fixes #110

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #110
@konard konard self-assigned this Sep 13, 2025
…on work amount

This commit implements a comprehensive flows order sync system that:

- Tracks contributor activity across organization's public repositories
- Calculates work scores based on commits, PRs, issues, and code reviews
- Automatically syncs Discord roles based on contribution levels
- Provides detailed contribution reports and leaderboards
- Supports configurable time periods and role tiers

Key components:
- ContributionTrackingService: Aggregates GitHub activity metrics
- DiscordRoleSyncService: Manages Discord role assignments and reports
- FlowsOrderSyncTrigger: Orchestrates the sync process via GitHub issues
- Updated Program.cs with Discord bot token and sync configuration options

The system creates role tiers (Contributor Legend, Senior Contributor, Active Contributor, Contributor, Member) and assigns users based on their calculated work scores.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Discord and GitHub bot: flows order sync based on amount of work was put into organization's public repositories Discord and GitHub bot: flows order sync based on amount of work was put into organization's public repositories Sep 13, 2025
@konard
konard marked this pull request as ready for review September 13, 2025 03:44
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.

Discord and GitHub bot: flows order sync based on amount of work was put into organization's public repositories

1 participant