Skip to content

Commit af4a270

Browse files
authored
Merge pull request #20 from Ryjen1/add-help-wanted-labels
Add help wanted labels
2 parents db053ae + 3cedea4 commit af4a270

7 files changed

Lines changed: 1045 additions & 0 deletions

File tree

.github/workflows/auto-label.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Auto Label Issues and PRs
2+
3+
on:
4+
issues:
5+
types: [opened, edited]
6+
pull_request:
7+
types: [opened, edited, synchronize]
8+
label:
9+
types: [created, deleted]
10+
11+
jobs:
12+
label_issues:
13+
runs-on: ubuntu-latest
14+
if: github.event.action == 'opened' || github.event.action == 'edited'
15+
16+
steps:
17+
- name: Label enhancement issues
18+
uses: actions/github-script@v7
19+
with:
20+
script: |
21+
const issue = context.payload.issue || context.payload.pull_request;
22+
const title = issue.title.toLowerCase();
23+
const body = (issue.body || '').toLowerCase();
24+
const content = `${title} ${body}`;
25+
26+
const labels = [];
27+
28+
// Frontend labels
29+
if (content.match(/\b(ui|ux|frontend|react|nextjs|component|interface|design|css|tailwind)\b/)) {
30+
labels.push('frontend');
31+
}
32+
33+
// Backend labels
34+
if (content.match(/\b(api|backend|server|database|postgres|neon)\b/)) {
35+
labels.push('backend');
36+
}
37+
38+
// Smart contract labels
39+
if (content.match(/\b(solidity|contract|smart|blockchain|foundry|whispr)\b/)) {
40+
labels.push('smart-contracts');
41+
}
42+
43+
// Documentation labels
44+
if (content.match(/\b(doc|readme|guide|tutorial|documentation)\b/)) {
45+
labels.push('documentation');
46+
}
47+
48+
// Testing labels
49+
if (content.match(/\b(test|testing|unit|integration|e2e|coverage)\b/)) {
50+
labels.push('testing');
51+
}
52+
53+
// Bug labels
54+
if (content.match(/\b(bug|error|fix|broken|issue|problem)\b/)) {
55+
labels.push('bug');
56+
}
57+
58+
// Enhancement labels
59+
if (content.match(/\b(feature|enhancement|improve|add|implement|support)\b/)) {
60+
labels.push('enhancement');
61+
}
62+
63+
// Help wanted labels
64+
const hasHelpWantedKeywords = content.match(/\b(help|welcome|contribution|community)\b/);
65+
const isEnhancement = labels.includes('enhancement') || labels.includes('documentation') || labels.includes('testing');
66+
const isBug = labels.includes('bug');
67+
68+
if (hasHelpWantedKeywords || (isEnhancement && !isBug)) {
69+
labels.push('help wanted');
70+
}
71+
72+
// Good first issue labels
73+
const hasGoodFirstKeywords = content.match(/\b(simple|easy|beginner|starter|quick)\b/);
74+
const isShortContent = content.length < 500;
75+
const isDocOnly = labels.includes('documentation') && !labels.includes('smart-contracts') && !labels.includes('backend');
76+
77+
if ((hasGoodFirstKeywords || isDocOnly) && isShortContent && !content.match(/\b(complex|advanced|security)\b/)) {
78+
labels.push('good first issue');
79+
}
80+
81+
// Apply labels if any were identified
82+
if (labels.length > 0) {
83+
try {
84+
await github.rest.issues.addLabels({
85+
owner: context.repo.owner,
86+
repo: context.repo.repo,
87+
issue_number: issue.number,
88+
labels: labels
89+
});
90+
console.log(`Applied labels to ${issue.html_url}: ${labels.join(', ')}`);
91+
} catch (error) {
92+
console.log(`Error applying labels: ${error.message}`);
93+
}
94+
}
95+
96+
welcome_new_contributors:
97+
runs-on: ubuntu-latest
98+
if: github.event.action == 'opened'
99+
100+
steps:
101+
- name: Welcome new contributors
102+
uses: actions/github-script@v7
103+
with:
104+
script: |
105+
const issue = context.payload.issue || context.payload.pull_request;
106+
const isPR = !!context.payload.pull_request;
107+
const url = issue.html_url;
108+
109+
if (context.actor !== context.repo.owner) {
110+
const welcomeMessage = isPR
111+
? `🎉 Thanks for your contribution to BlockBelle! We'll review your pull request shortly.`
112+
: `👋 Welcome to BlockBelle! Thanks for your interest in helping improve this project.`;
113+
114+
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)!`;
115+
116+
try {
117+
await github.rest.issues.createComment({
118+
owner: context.repo.owner,
119+
repo: context.repo.repo,
120+
issue_number: issue.number,
121+
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!`
122+
});
123+
} catch (error) {
124+
console.log(`Error creating welcome comment: ${error.message}`);
125+
}
126+
}
127+
128+
weekly_label_review:
129+
runs-on: ubuntu-latest
130+
if: github.event_name == 'schedule'
131+
132+
steps:
133+
- name: Review and suggest labels for old issues
134+
uses: actions/github-script@v7
135+
with:
136+
script: |
137+
const oneWeekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString();
138+
139+
const { data: issues } = await github.rest.issues.listForRepo({
140+
owner: context.repo.owner,
141+
repo: context.repo.repo,
142+
state: 'open',
143+
since: oneWeekAgo,
144+
per_page: 100
145+
});
146+
147+
for (const issue of issues) {
148+
const hasHelpWanted = issue.labels.some(label => label.name === 'help wanted');
149+
const hasGoodFirst = issue.labels.some(label => label.name === 'good first issue');
150+
const hasEnhancement = issue.labels.some(label => label.name === 'enhancement');
151+
152+
// Suggest help wanted for unlabelled enhancements
153+
if (!hasHelpWanted && hasEnhancement) {
154+
console.log(`Suggesting 'help wanted' label for issue: ${issue.title}`);
155+
156+
// Add a comment suggesting the label
157+
await github.rest.issues.createComment({
158+
owner: context.repo.owner,
159+
repo: context.repo.repo,
160+
issue_number: issue.number,
161+
body: `💡 This issue looks like it could benefit from community help! Consider adding the \`help wanted\` label to attract contributors.`
162+
});
163+
}
164+
}

docs/PR_PREPARATION.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Pull Request: Add Help Wanted Labels System
2+
3+
## Summary
4+
5+
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.
6+
7+
## What This PR Does
8+
9+
### 🎯 Core Implementation
10+
- **Labels Framework**: 10 primary and secondary labels for categorizing issues
11+
- **Issue Templates**: 3 pre-built templates for different contribution types
12+
- **Automation Tools**: Scripts and GitHub Actions for label management
13+
- **Documentation**: Complete guides for maintainers and contributors
14+
15+
### 📋 Files Changed
16+
17+
#### Documentation (New)
18+
- `docs/help-wanted-analysis.md` - Comprehensive codebase analysis
19+
- `docs/help-wanted-labels-guide.md` - Implementation and usage guide
20+
- `docs/PR_PREPARATION.md` - This file
21+
22+
#### Scripts (New)
23+
- `scripts/labels-setup.sh` - Automated GitHub label creation
24+
- `scripts/label-issues.py` - Smart issue labeling tool
25+
- `scripts/requirements.txt` - Python dependencies
26+
27+
#### GitHub Actions (New)
28+
- `.github/workflows/auto-label.yml` - Automated labeling workflow
29+
30+
## Immediate Action Items
31+
32+
### 1. Review the Documentation
33+
Read the following files to understand the complete system:
34+
- `docs/help-wanted-analysis.md` - Understanding of project areas needing help
35+
- `docs/help-wanted-labels-guide.md` - Implementation instructions
36+
- This file - Next steps and timeline
37+
38+
### 2. Create GitHub Labels
39+
Use the automated script to create all necessary labels:
40+
41+
```bash
42+
# Make sure you have a GitHub token with repo permissions
43+
export GITHUB_TOKEN="your_token_here"
44+
45+
# Run the label setup script
46+
./scripts/labels-setup.sh $GITHUB_TOKEN Ryjen1 BlockBelle
47+
```
48+
49+
### 3. Apply Labels to Existing Issues
50+
Run the issue analysis script to suggest labels:
51+
52+
```bash
53+
# Install dependencies
54+
pip install -r scripts/requirements.txt
55+
56+
# Analyze and suggest labels (manual mode)
57+
python scripts/label-issues.py $GITHUB_TOKEN Ryjen1 BlockBelle
58+
59+
# Or auto-apply all suggestions
60+
python scripts/label-issues.py $GITHUB_TOKEN Ryjen1 BlockBelle --auto
61+
```
62+
63+
### 4. Enable GitHub Actions
64+
The workflow file is included and will automatically:
65+
- Label new issues based on content analysis
66+
- Welcome new contributors with helpful messages
67+
- Suggest "help wanted" labels for unlabelled enhancement issues
68+
69+
## Expected Timeline
70+
71+
### Day 1: Setup (30 minutes)
72+
- [ ] Create GitHub labels using automation script
73+
- [ ] Test issue labeling on a few existing issues
74+
- [ ] Verify GitHub Actions workflow is enabled
75+
76+
### Day 2: Launch (15 minutes)
77+
- [ ] Create 5-10 new issues using the provided templates
78+
- [ ] Apply "help wanted" labels to appropriate existing issues
79+
- [ ] Announce in project documentation/communication channels
80+
81+
### Week 1: Monitor & Adjust
82+
- [ ] Review automated labeling accuracy
83+
- [ ] Adjust labeling rules if needed
84+
- [ ] Track community engagement with labeled issues
85+
86+
## Benefits for the Project
87+
88+
### For Contributors
89+
- **Clear Entry Points**: Good first issues for newcomers
90+
- **Detailed Guidance**: Templates ensure well-described tasks
91+
- **Automated Support**: Welcome messages and helpful comments
92+
93+
### for Maintainers
94+
- **Organized Issues**: Systematic labeling improves project management
95+
- **Reduced Friction**: Automated workflows handle routine tasks
96+
- **Community Growth**: Clear pathways for new contributors
97+
98+
### For the Project
99+
- **Increased Contributions**: Better discoverability of contribution opportunities
100+
- **Quality Improvement**: More community eyes lead to better code
101+
- **Sustainable Growth**: Systems that support long-term contributor engagement
102+
103+
## Monitoring Success
104+
105+
### Key Metrics to Track
106+
1. **New Contributors**: Number of first-time contributors per month
107+
2. **Help Wanted Issues**: Ratio of labeled to unlabeled enhancement issues
108+
3. **Issue Resolution**: Time to close "good first issues"
109+
4. **Community Engagement**: Comments and discussions on labeled issues
110+
111+
### Monthly Reviews
112+
- Review labeling accuracy and adjust rules
113+
- Archive completed "help wanted" issues
114+
- Add new issues based on project evolution
115+
- Update documentation based on community feedback
116+
117+
## Support & Resources
118+
119+
### For Contributors
120+
- **Getting Started**: Check `docs/help-wanted-analysis.md` for beginner-friendly tasks
121+
- **Contribution Guide**: Refer to issue templates for detailed requirements
122+
- **Help Available**: All labeled issues welcome community questions and discussions
123+
124+
### For Maintainers
125+
- **Label Management**: Use `scripts/labels-setup.sh` for consistent labeling
126+
- **Issue Creation**: Template files ensure quality issue descriptions
127+
- **Automation**: GitHub Actions handle routine labeling tasks
128+
129+
## Rollback Plan
130+
131+
If needed, the system can be easily removed:
132+
1. Delete GitHub labels through repository settings
133+
2. Remove `.github/workflows/auto-label.yml`
134+
3. Archive or delete the documentation files
135+
4. The scripts are standalone and don't affect core functionality
136+
137+
## Next Steps After Merge
138+
139+
1. **Immediate**: Follow the "Immediate Action Items" section above
140+
2. **Week 1**: Monitor automated labeling and community response
141+
3. **Month 1**: Evaluate metrics and adjust the system as needed
142+
4. **Ongoing**: Keep the system current with project evolution
143+
144+
## Questions or Issues?
145+
146+
If you encounter any problems with this implementation:
147+
1. Check the troubleshooting section in `docs/help-wanted-labels-guide.md`
148+
2. Review the automation scripts for error handling
149+
3. Consider temporary manual labeling while troubleshooting
150+
151+
---
152+
153+
**Ready to build a more contributor-friendly community? Let's make BlockBelle accessible to everyone!** 🚀

0 commit comments

Comments
 (0)