feature-popularity.yml

 1name: "Feature Request Triage"
 2
 3on:
 4  schedule:
 5    - cron: "0 3 * * 1"
 6  issues:
 7    types: [opened, labeled]
 8  workflow_dispatch:
 9
10permissions:
11  issues: write
12
13jobs:
14  welcome:
15    if: github.event_name == 'issues' && github.event.action == 'opened' && contains(github.event.issue.labels.*.name, 'enhancement')
16    runs-on: ubuntu-latest
17    steps:
18      - uses: actions/github-script@v9
19        with:
20          github-token: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
21          script: |
22            await github.rest.issues.createComment({
23              owner: context.repo.owner,
24              repo: context.repo.repo,
25              issue_number: context.payload.issue.number,
26              body: [
27                "Thanks for the suggestion!",
28                "",
29                "If you want to see this feature land, give the original post a 👍. Maintainers prioritize feature requests by reaction count.",
30                "Comment to add detail or use cases — extra context helps triage."
31              ].join("\n")
32            });
33
34  promote-popular:
35    if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
36    runs-on: ubuntu-latest
37    steps:
38      - uses: actions/github-script@v9
39        with:
40          github-token: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
41          script: |
42            const threshold = 10;
43            const issues = await github.paginate(github.rest.issues.listForRepo, {
44              owner: context.repo.owner,
45              repo: context.repo.repo,
46              state: 'open',
47              labels: 'enhancement',
48              per_page: 100
49            });
50            for (const issue of issues) {
51              if (issue.pull_request) continue;
52              if (issue.labels.some(l => (l.name || l) === 'popular')) continue;
53              const upvotes = (issue.reactions && issue.reactions['+1']) || 0;
54              if (upvotes >= threshold) {
55                await github.rest.issues.addLabels({
56                  owner: context.repo.owner,
57                  repo: context.repo.repo,
58                  issue_number: issue.number,
59                  labels: ['popular']
60                });
61                core.info(`labeled #${issue.number} popular (${upvotes} 👍)`);
62              }
63            }