name: refresh-plugin-popularity on: # Weekly refresh so the plugin/example grid + Home rail keep leading each # category with the templates users actually reach for (OPEND-449). Templates # rotate roughly monthly, so a weekly trailing-window rebuild stays fresh. schedule: - cron: '0 2 * * 1' # Manual trigger: force a rebuild outside the weekly schedule. workflow_dispatch: inputs: window: description: 'Trailing window in days (blank = 28)' required: false permissions: contents: read concurrency: group: refresh-plugin-popularity cancel-in-progress: true jobs: refresh: name: Refresh template popularity ordering if: github.repository == 'nexu-io/open-design' runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6.0.2 - name: Setup pnpm uses: pnpm/action-setup@v4 - name: Setup Node uses: actions/setup-node@v4 with: node-version: 24 cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - name: Rebuild pluginPopularity.generated.ts # HogQL needs a personal API key (phx_…). Prefer a dedicated # POSTHOG_PERSONAL_API_KEY; fall back to the existing POSTHOG_CLI_API_KEY, # which is already a personal key used for release sourcemap uploads. # If neither can query, the script warns and no-ops (exit 0) so this # stays green and opens no PR. env: POSTHOG_PERSONAL_API_KEY: ${{ secrets.POSTHOG_PERSONAL_API_KEY }} POSTHOG_CLI_API_KEY: ${{ secrets.POSTHOG_CLI_API_KEY }} run: pnpm exec tsx scripts/refresh-plugin-popularity.ts --write --window=${{ github.event.inputs.window || '28' }} - name: Generate OpenDesign bot token id: open-design-bot-token uses: actions/create-github-app-token@v3.2.0 with: client-id: ${{ secrets.BOT_APP_CLIENT_ID }} private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }} owner: nexu-io repositories: open-design permission-contents: write permission-pull-requests: write - name: Create refresh pull request uses: peter-evans/create-pull-request@v8 with: token: ${{ steps.open-design-bot-token.outputs.token }} add-paths: apps/web/src/components/plugins-home/pluginPopularity.generated.ts branch: automation/refresh-plugin-popularity delete-branch: true commit-message: 'chore(plugins-home): refresh template popularity ordering' author: 'open-design-bot[bot] <282769551+open-design-bot[bot]@users.noreply.github.com>' committer: 'open-design-bot[bot] <282769551+open-design-bot[bot]@users.noreply.github.com>' title: 'chore(plugins-home): refresh template popularity ordering' body: | Rebuilds `pluginPopularity.generated.ts` from the trailing-window PostHog usage so the plugin/example grid and Home rail keep leading each category with the most-reached-for templates (OPEND-449). Generated by the scheduled `refresh-plugin-popularity` workflow. Only the generated data file changes; review the diff to sanity-check the movement, then merge.