Files
semantica/.github/workflows/issue-bot.yml
T
Workflow config file is invalid. Please check your config file: resolve aliases: yaml: line 85: did not find expected key

101 lines
3.8 KiB
YAML

name: Issue Helper Bot
on:
issues:
types: [opened]
issue_comment:
types: [created]
jobs:
auto-label:
name: Auto-label Issues (Conservative)
runs-on: ubuntu-latest
if: github.event.action == 'opened'
steps:
- name: Label based on keywords (only clear matches)
uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue;
const title = issue.title.toLowerCase();
const body = (issue.body || '').toLowerCase();
const text = title + ' ' + body;
const labels = [];
// Only label if there are clear, strong indicators
// Bug detection - must have multiple indicators
if ((text.match(/\b(bug|crash|broken|fails|doesn't work|not working)\b/) &&
text.match(/\b(error|exception|traceback|problem)\b/)) ||
title.startsWith('bug:') || title.startsWith('[bug]')) {
labels.push('bug');
}
// Feature request - must be explicit
else if (text.match(/\b(feature request|enhancement request|proposal)\b/) ||
title.startsWith('feature:') || title.startsWith('[feature]') ||
title.startsWith('enhancement:') || title.startsWith('[enhancement]')) {
labels.push('enhancement');
}
// Documentation - must be explicit
else if (text.match(/\b(documentation issue|doc fix|docs update)\b/) ||
title.startsWith('docs:') || title.startsWith('[docs]')) {
labels.push('documentation');
}
// Security - must be explicit
else if (text.match(/\b(security issue|vulnerability|security bug)\b/) ||
title.startsWith('security:') || title.startsWith('[security]')) {
labels.push('security');
}
// Only add needs-triage if no labels and issue seems incomplete
if (labels.length === 0 && (body.length < 50 || !body.includes('\n'))) {
labels.push('needs-triage');
}
// Add labels only if we found something
if (labels.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: labels
});
}
respond-to-help-request:
name: Respond Only to Explicit Help Requests
runs-on: ubuntu-latest
if: |
github.event.action == 'opened' &&
(contains(github.event.issue.body, '/help') || contains(github.event.issue.title, '/help'))
steps:
- name: Provide help resources
uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue;
const response = `📚 **Help Resources**
Here are some helpful resources:
- [Getting Started](https://github.com/${{ github.repository }}/blob/main/docs/getting-started.md)
- [FAQ](https://github.com/${{ github.repository }}/blob/main/docs/faq.md)
- [Documentation](https://github.com/${{ github.repository }}/tree/main/docs)
- [GitHub Discussions](https://github.com/${{ github.repository }}/discussions) - Ask questions here
- [Discord](https://discord.gg/semantica) - Real-time chat
💡 **Tip**: For questions, consider using [GitHub Discussions](https://github.com/${{ github.repository }}/discussions) instead of issues.`;
await github.rest.issues.createComment({
issue_number: issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: response
});