[ENHANCEMENT] #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Project Management | |
| on: | |
| issues: | |
| types: [opened, edited, labeled] | |
| schedule: | |
| - cron: '0 0 * * 0' # Weekly cleanup on Sunday | |
| jobs: | |
| # Auto-label issues | |
| auto-label: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'issues' | |
| permissions: | |
| issues: write | |
| steps: | |
| - name: Auto-label based on content | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const item = context.payload.issue; | |
| const body = (item.body || '').toLowerCase(); | |
| const title = (item.title || '').toLowerCase(); | |
| const labels = []; | |
| // Platform labels | |
| if (title.includes('telegram') || body.includes('telegram')) labels.push('platform:telegram'); | |
| if (title.includes('email') || body.includes('email')) labels.push('platform:email'); | |
| if (title.includes('line') || body.includes('line')) labels.push('platform:line'); | |
| if (title.includes('discord') || body.includes('discord')) labels.push('platform:discord'); | |
| // Priority labels | |
| if (title.includes('critical') || body.includes('critical')) labels.push('priority:high'); | |
| if (title.includes('urgent') || body.includes('urgent')) labels.push('priority:high'); | |
| // Type labels | |
| if (title.includes('[bug]')) labels.push('type:bug'); | |
| if (title.includes('[feature]')) labels.push('type:enhancement'); | |
| if (title.includes('[question]')) labels.push('type:question'); | |
| if (title.includes('[security]')) labels.push('type:security'); | |
| if (title.includes('[performance]')) labels.push('type:performance'); | |
| if (title.includes('[enhancement]')) labels.push('type:enhancement'); | |
| if (title.includes('[discussion]')) labels.push('type:discussion'); | |
| if (labels.length > 0) { | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: item.number, | |
| labels: labels | |
| }); | |
| } | |
| # Weekly maintenance | |
| weekly-cleanup: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'schedule' | |
| permissions: | |
| issues: write | |
| steps: | |
| - name: Close stale issues | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { data: issues } = await github.rest.issues.listForRepo({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| state: 'open', | |
| labels: 'question', | |
| sort: 'updated', | |
| direction: 'asc', | |
| per_page: 100 | |
| }); | |
| const thirtyDaysAgo = new Date(); | |
| thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30); | |
| for (const issue of issues) { | |
| if (new Date(issue.updated_at) < thirtyDaysAgo) { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue.number, | |
| body: 'This question has been inactive for 30 days and will be closed. Feel free to reopen if you still need help.' | |
| }); | |
| await github.rest.issues.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue.number, | |
| state: 'closed' | |
| }); | |
| } | |
| } |