feat: sync portfolio projects from GitHub - #8
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an automated “Portfolio Sync” pipeline that periodically and event-driven syncs eligible GitHub repositories into a public KV-backed project index, and updates the web Dashboard to merge that remote index over the curated static fallback list.
Changes:
- Introduces a Cloudflare Worker (webhook + cron) that verifies GitHub App webhooks, scans installation repositories for manifest/metadata contracts, and publishes a versioned project envelope to Workers KV.
- Adds Dashboard runtime fetching/validation and merge logic to overlay synced status/progress/links while retaining curated copy and a static fallback.
- Documents the sync design/contract and adds CI to dry-run validate the Worker bundle/config on PRs.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| workers/portfolio-sync-webhook/wrangler.jsonc | New Worker config: KV binding, cron trigger, custom domain route, env vars. |
| workers/portfolio-sync-webhook/src/index.mjs | New Worker implementation: webhook verification, GitHub App auth, repo scanning, KV publishing, health/projects endpoints. |
| workers/portfolio-sync-webhook/package.json | Adds Worker deploy and dry-run scripts pinned to a Wrangler version. |
| docs/superpowers/specs/2026-08-14-portfolio-sync-design.md | Documents architecture, trust boundaries, and failure behavior. |
| docs/superpowers/plans/2026-08-14-portfolio-sync.md | Implementation plan for Worker/Dashboard/Evidence tasks. |
| docs/portfolio-project-contract.md | Defines the publish + portfolio metadata contract used by the sync. |
| apps/web/apps/web/src/features/portfolio/dashboard-content.tsx | Fetches synced envelope on mount and displays last sync timestamp with fallback behavior. |
| apps/web/apps/web/src/data/portfolio-sync.ts | Adds envelope validation + merge logic for curated vs synced projects. |
| apps/web/apps/web/src/data/portfolio-projects.ts | Extends project model with sourceUpdatedAt and adds the Portfolio Sync project card. |
| .github/workflows/verify-portfolio-sync.yml | New CI workflow to run Wrangler deploy dry-run for the Worker on PRs/pushes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+13
to
+29
| function isProject(value: unknown): value is PortfolioProject { | ||
| if (!value || typeof value !== "object") return false; | ||
| const project = value as Partial<PortfolioProject>; | ||
| return Boolean( | ||
| project.id && | ||
| project.title && | ||
| project.desc && | ||
| project.architecture && | ||
| project.evidenceUrl && | ||
| project.repo && | ||
| Array.isArray(project.skills) && | ||
| Array.isArray(project.evidence) && | ||
| Array.isArray(project.details) && | ||
| (project.status === "已完成" || project.status === "进行中") && | ||
| typeof project.progress === "number", | ||
| ); | ||
| } |
Comment on lines
+129
to
+140
| const results = await Promise.all( | ||
| candidates.map(async (repo) => { | ||
| try { | ||
| return await projectFromRepository(repo, token); | ||
| } catch (error) { | ||
| warnings.push( | ||
| error instanceof Error ? error.message : "unknown repository error", | ||
| ); | ||
| return null; | ||
| } | ||
| }), | ||
| ); |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary\n- add GitHub App webhook Worker with KV and 30-minute recovery\n- merge validated remote project metadata into the Dashboard with static fallback\n- add Portfolio Sync project card and repository contract\n\n## Production\n- Worker: https://portfolio-sync.baby2b.online\n- Health: https://portfolio-sync.baby2b.online/health\n- GitHub permission: contents read-only