|
| 1 | +name: Weekly Issue Triage |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Runs at 08:00 UTC every Wednesday |
| 6 | + - cron: '0 8 * * 3' |
| 7 | + workflow_dispatch: # Allows you to manually trigger it for testing |
| 8 | + |
| 9 | +jobs: |
| 10 | + triage-issues: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Generate Issue Report |
| 14 | + uses: actions/github-script@v7 |
| 15 | + with: |
| 16 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 17 | + script: | |
| 18 | + const owner = context.repo.owner; |
| 19 | + const repo = context.repo.repo; |
| 20 | + |
| 21 | + // Fetch all open issues (pagination logic may be needed for >100 issues) |
| 22 | + const opts = github.rest.issues.listForRepo.endpoint.merge({ |
| 23 | + owner: owner, |
| 24 | + repo: repo, |
| 25 | + state: 'open', |
| 26 | + per_page: 100 |
| 27 | + }); |
| 28 | + const issues = await github.paginate(opts); |
| 29 | + |
| 30 | + let noLabels = []; |
| 31 | + let withLabels = []; |
| 32 | + |
| 33 | + for (const issue of issues) { |
| 34 | + // Skip pull requests, issues API returns both |
| 35 | + if (issue.pull_request) continue; |
| 36 | + |
| 37 | + const summary = `- #${issue.number} ${issue.title} (${issue.html_url})`; |
| 38 | + |
| 39 | + if (issue.labels.length === 0) { |
| 40 | + noLabels.push(summary); |
| 41 | + } else { |
| 42 | + const labelNames = issue.labels.map(l => l.name).join(', '); |
| 43 | + withLabels.push(`${summary} [Labels: ${labelNames}]`); |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + const report = ` |
| 48 | + ### Weekly Issue Triage Report 📋 |
| 49 | + |
| 50 | + #### 1. Issues without a label (${noLabels.length}) |
| 51 | + ${noLabels.join('\n')} |
| 52 | + |
| 53 | + #### 2. Issues with a label (${withLabels.length}) |
| 54 | + ${withLabels.join('\n')} |
| 55 | + `; |
| 56 | + |
| 57 | + console.log(report); |
| 58 | + |
| 59 | + // Option: Create a new Issue with this report, or just log it |
| 60 | + // core.setOutput('report', report); |
0 commit comments