mirror of
https://github.com/nexu-io/open-design.git
synced 2026-09-20 06:15:06 +08:00
94d48f41f2
* feat(plugins-home): order the template gallery by usage (OPEND-449) Non-prototype facets (Slides, Image, Video, …) now lead by real usage — a trailing 28-day blend of distinct-users + runs from `run_finished`. The Prototype facet keeps its curated editorial order; the default mode-seeds (Web Prototype, Simple Deck) and no-preview / manually-sunk tiles drop to the bottom of their facet and the All view. Ordering lives in one shared comparator (`comparePluginGalleryOrder`) used by the grid and the Home rail; the All view keeps its visual-appeal order with sunk tiles pushed last. A weekly in-repo workflow rebuilds the popularity snapshot from PostHog and opens a self-PR; a committed snapshot ships the ordering immediately. * test(plugins-home): make Live Artifact grouping assertions order-insensitive The rail + Community-section tests hardcoded the curated Live Artifact preset order. Facet order is now usage/sink-driven (OPEND-449), so these grouping/ routing tests assert membership via a sorted comparison instead. --------- Co-authored-by: Scarlett Huang <scarletthuang@Scarletts-MacBook-Air.local>
86 lines
3.2 KiB
YAML
86 lines
3.2 KiB
YAML
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 Open Design 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.
|