Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: Auto Label Issues and PRs

on:
issues:
types: [opened, edited]
pull_request:
types: [opened, edited, synchronize]
label:
types: [created, deleted]

jobs:
label_issues:
runs-on: ubuntu-latest
if: github.event.action == 'opened' || github.event.action == 'edited'

steps:
- name: Label enhancement issues
uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue || context.payload.pull_request;
const title = issue.title.toLowerCase();
const body = (issue.body || '').toLowerCase();
const content = `${title} ${body}`;

const labels = [];

// Frontend labels
if (content.match(/\b(ui|ux|frontend|react|nextjs|component|interface|design|css|tailwind)\b/)) {
labels.push('frontend');
}

// Backend labels
if (content.match(/\b(api|backend|server|database|postgres|neon)\b/)) {
labels.push('backend');
}

// Smart contract labels
if (content.match(/\b(solidity|contract|smart|blockchain|foundry|whispr)\b/)) {
labels.push('smart-contracts');
}

// Documentation labels
if (content.match(/\b(doc|readme|guide|tutorial|documentation)\b/)) {
labels.push('documentation');
}

// Testing labels
if (content.match(/\b(test|testing|unit|integration|e2e|coverage)\b/)) {
labels.push('testing');
}

// Bug labels
if (content.match(/\b(bug|error|fix|broken|issue|problem)\b/)) {
labels.push('bug');
}

// Enhancement labels
if (content.match(/\b(feature|enhancement|improve|add|implement|support)\b/)) {
labels.push('enhancement');
}

// Help wanted labels
const hasHelpWantedKeywords = content.match(/\b(help|welcome|contribution|community)\b/);
const isEnhancement = labels.includes('enhancement') || labels.includes('documentation') || labels.includes('testing');
const isBug = labels.includes('bug');

if (hasHelpWantedKeywords || (isEnhancement && !isBug)) {
labels.push('help wanted');
}

// Good first issue labels
const hasGoodFirstKeywords = content.match(/\b(simple|easy|beginner|starter|quick)\b/);
const isShortContent = content.length < 500;
const isDocOnly = labels.includes('documentation') && !labels.includes('smart-contracts') && !labels.includes('backend');

if ((hasGoodFirstKeywords || isDocOnly) && isShortContent && !content.match(/\b(complex|advanced|security)\b/)) {
labels.push('good first issue');
}

// Apply labels if any were identified
if (labels.length > 0) {
try {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: labels
});
console.log(`Applied labels to ${issue.html_url}: ${labels.join(', ')}`);
} catch (error) {
console.log(`Error applying labels: ${error.message}`);
}
}

welcome_new_contributors:
runs-on: ubuntu-latest
if: github.event.action == 'opened'

steps:
- name: Welcome new contributors
uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue || context.payload.pull_request;
const isPR = !!context.payload.pull_request;
const url = issue.html_url;

if (context.actor !== context.repo.owner) {
const welcomeMessage = isPR
? `🎉 Thanks for your contribution to BlockBelle! We'll review your pull request shortly.`
: `👋 Welcome to BlockBelle! Thanks for your interest in helping improve this project.`;

const helpMessage = `📝 Looking for ways to help? Check out our ["help wanted" issues](${context.payload.repository.html_url}/labels/help%20wanted) and [good first issues](${context.payload.repository.html_url}/labels/good%20first%20issue)!`;

try {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: `${welcomeMessage}\n\n${helpMessage}\n\n💡 Don't forget to check out our [contribution guide](${context.payload.repository.html_url}/blob/main/docs/help-wanted-labels-guide.md) for more details!`
});
} catch (error) {
console.log(`Error creating welcome comment: ${error.message}`);
}
}

weekly_label_review:
runs-on: ubuntu-latest
if: github.event_name == 'schedule'

steps:
- name: Review and suggest labels for old issues
uses: actions/github-script@v7
with:
script: |
const oneWeekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString();

const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
since: oneWeekAgo,
per_page: 100
});

for (const issue of issues) {
const hasHelpWanted = issue.labels.some(label => label.name === 'help wanted');
const hasGoodFirst = issue.labels.some(label => label.name === 'good first issue');
const hasEnhancement = issue.labels.some(label => label.name === 'enhancement');

// Suggest help wanted for unlabelled enhancements
if (!hasHelpWanted && hasEnhancement) {
console.log(`Suggesting 'help wanted' label for issue: ${issue.title}`);

// Add a comment suggesting the label
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: `💡 This issue looks like it could benefit from community help! Consider adding the \`help wanted\` label to attract contributors.`
});
}
}
153 changes: 153 additions & 0 deletions docs/PR_PREPARATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Pull Request: Add Help Wanted Labels System

## Summary

This PR implements a comprehensive "help wanted" labeling system to encourage community contributions to the BlockBelle project. The system includes automated labeling, detailed documentation, and practical tools for maintaining contributor-friendly issues.

## What This PR Does

### 🎯 Core Implementation
- **Labels Framework**: 10 primary and secondary labels for categorizing issues
- **Issue Templates**: 3 pre-built templates for different contribution types
- **Automation Tools**: Scripts and GitHub Actions for label management
- **Documentation**: Complete guides for maintainers and contributors

### 📋 Files Changed

#### Documentation (New)
- `docs/help-wanted-analysis.md` - Comprehensive codebase analysis
- `docs/help-wanted-labels-guide.md` - Implementation and usage guide
- `docs/PR_PREPARATION.md` - This file

#### Scripts (New)
- `scripts/labels-setup.sh` - Automated GitHub label creation
- `scripts/label-issues.py` - Smart issue labeling tool
- `scripts/requirements.txt` - Python dependencies

#### GitHub Actions (New)
- `.github/workflows/auto-label.yml` - Automated labeling workflow

## Immediate Action Items

### 1. Review the Documentation
Read the following files to understand the complete system:
- `docs/help-wanted-analysis.md` - Understanding of project areas needing help
- `docs/help-wanted-labels-guide.md` - Implementation instructions
- This file - Next steps and timeline

### 2. Create GitHub Labels
Use the automated script to create all necessary labels:

```bash
# Make sure you have a GitHub token with repo permissions
export GITHUB_TOKEN="your_token_here"

# Run the label setup script
./scripts/labels-setup.sh $GITHUB_TOKEN Ryjen1 BlockBelle
```

### 3. Apply Labels to Existing Issues
Run the issue analysis script to suggest labels:

```bash
# Install dependencies
pip install -r scripts/requirements.txt

# Analyze and suggest labels (manual mode)
python scripts/label-issues.py $GITHUB_TOKEN Ryjen1 BlockBelle

# Or auto-apply all suggestions
python scripts/label-issues.py $GITHUB_TOKEN Ryjen1 BlockBelle --auto
```

### 4. Enable GitHub Actions
The workflow file is included and will automatically:
- Label new issues based on content analysis
- Welcome new contributors with helpful messages
- Suggest "help wanted" labels for unlabelled enhancement issues

## Expected Timeline

### Day 1: Setup (30 minutes)
- [ ] Create GitHub labels using automation script
- [ ] Test issue labeling on a few existing issues
- [ ] Verify GitHub Actions workflow is enabled

### Day 2: Launch (15 minutes)
- [ ] Create 5-10 new issues using the provided templates
- [ ] Apply "help wanted" labels to appropriate existing issues
- [ ] Announce in project documentation/communication channels

### Week 1: Monitor & Adjust
- [ ] Review automated labeling accuracy
- [ ] Adjust labeling rules if needed
- [ ] Track community engagement with labeled issues

## Benefits for the Project

### For Contributors
- **Clear Entry Points**: Good first issues for newcomers
- **Detailed Guidance**: Templates ensure well-described tasks
- **Automated Support**: Welcome messages and helpful comments

### for Maintainers
- **Organized Issues**: Systematic labeling improves project management
- **Reduced Friction**: Automated workflows handle routine tasks
- **Community Growth**: Clear pathways for new contributors

### For the Project
- **Increased Contributions**: Better discoverability of contribution opportunities
- **Quality Improvement**: More community eyes lead to better code
- **Sustainable Growth**: Systems that support long-term contributor engagement

## Monitoring Success

### Key Metrics to Track
1. **New Contributors**: Number of first-time contributors per month
2. **Help Wanted Issues**: Ratio of labeled to unlabeled enhancement issues
3. **Issue Resolution**: Time to close "good first issues"
4. **Community Engagement**: Comments and discussions on labeled issues

### Monthly Reviews
- Review labeling accuracy and adjust rules
- Archive completed "help wanted" issues
- Add new issues based on project evolution
- Update documentation based on community feedback

## Support & Resources

### For Contributors
- **Getting Started**: Check `docs/help-wanted-analysis.md` for beginner-friendly tasks
- **Contribution Guide**: Refer to issue templates for detailed requirements
- **Help Available**: All labeled issues welcome community questions and discussions

### For Maintainers
- **Label Management**: Use `scripts/labels-setup.sh` for consistent labeling
- **Issue Creation**: Template files ensure quality issue descriptions
- **Automation**: GitHub Actions handle routine labeling tasks

## Rollback Plan

If needed, the system can be easily removed:
1. Delete GitHub labels through repository settings
2. Remove `.github/workflows/auto-label.yml`
3. Archive or delete the documentation files
4. The scripts are standalone and don't affect core functionality

## Next Steps After Merge

1. **Immediate**: Follow the "Immediate Action Items" section above
2. **Week 1**: Monitor automated labeling and community response
3. **Month 1**: Evaluate metrics and adjust the system as needed
4. **Ongoing**: Keep the system current with project evolution

## Questions or Issues?

If you encounter any problems with this implementation:
1. Check the troubleshooting section in `docs/help-wanted-labels-guide.md`
2. Review the automation scripts for error handling
3. Consider temporary manual labeling while troubleshooting

---

**Ready to build a more contributor-friendly community? Let's make BlockBelle accessible to everyone!** 🚀
Loading