Skip to content

chore: notify Feishu when GitHub Project draft items change#541

Merged
qiongyu1999 merged 3 commits intomainfrom
feat/feishu-project-notify
Mar 25, 2026
Merged

chore: notify Feishu when GitHub Project draft items change#541
qiongyu1999 merged 3 commits intomainfrom
feat/feishu-project-notify

Conversation

@qiongyu1999
Copy link
Copy Markdown
Collaborator

@qiongyu1999 qiongyu1999 commented Mar 25, 2026

Summary

  • 新增 GitHub Actions workflow 监听 projects_v2_item 事件(created / edited / archived / deleted / restored)
  • 新增飞书通知脚本,通过 GraphQL API 获取 Project Item 完整信息(标题、描述、负责人、状态、优先级等),发送飞书卡片消息
  • 不同操作类型使用不同颜色卡片:新建(蓝)、状态变更(橙)、负责人变更(蓝)、优先级变更(紫)、归档(灰)、删除(红)、恢复(绿)

Prerequisites

  • nexu-pal GitHub App 已添加 organization_projects: read 权限
  • ISSUE_SYNC_FEISHU_BOT_WEBHOOK secret 已配置

New files

  • .github/workflows/feishu-project-item-notify.yml — workflow
  • scripts/notify/feishu-project-notify.mjs — 飞书通知脚本

Test plan

  • 在 Project Board 中新建一个 Draft item,确认飞书群收到蓝色卡片通知
  • 拖动 Draft 状态(如 Todo → In Progress),确认飞书群收到橙色卡片并显示状态变更
  • 修改 Draft 负责人,确认飞书群收到通知
  • 归档一个 Draft item,确认飞书群收到灰色卡片

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Sends interactive Feishu notifications for Projects V2 item events (create, edit, archive, delete, restore), including item details and a "View details" action.
  • Refactor

    • Minor internal naming cleanups in desktop and test code; no user-facing behavior changes.

Add workflow and script to send Feishu card notifications when
project board items are created, edited (status/assignee/priority
change), archived, deleted, or restored. Uses GraphQL to fetch
full item details including draft title, body, assignees, and
custom fields.

Made-with: Cursor
@qiongyu1999 qiongyu1999 requested a review from nettee March 25, 2026 10:02
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 25, 2026

📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow and a Node.js notification script to send Feishu interactive-card notifications for GitHub Projects v2 item events; includes small local identifier renames in desktop, launchd bootstrap, and an e2e test file.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
\.github/workflows/feishu-project-item-notify.yml
New workflow triggered on projects_v2_item events (created/edited/archived/deleted/restored). Sparse-checks out scripts/notify, creates a GitHub App installation token, and runs the Node notifier with event context passed via env vars.
Feishu Notification Script
scripts/notify/feishu-project-notify.mjs
New executable Node.js script that requires WEBHOOK_URL, reads event env vars, parses CHANGES_JSON, fetches item details via GitHub GraphQL (timeout/abort), derives metadata (title, type, status/priority, assignees, labels), composes an action-specific Feishu interactive card (optional "View details" link), posts to the webhook, and exits non-zero on failures.
Desktop component rename
apps/desktop/src/components/surface-frame.tsx
Local prop bindings renamed (titletitle: _title, descriptiondescription: _description) to avoid unused identifiers; no API or runtime behavior changes.
Launchd helper rename
apps/desktop/main/services/launchd-bootstrap.ts
Internal helper renamed from tryAttachToRunningServices_tryAttachToRunningServices; signature and behavior unchanged.
E2E test rename
apps/web/e2e/openai-oauth.spec.ts
Local test constant renamed from API_URL_API_URL; no behavior or test logic changes.

Sequence Diagram

sequenceDiagram
    participant GHProjects as GH Projects v2
    participant GHA as GitHub Actions (Workflow)
    participant Script as Notifier Script (Node)
    participant GraphQL as GitHub GraphQL API
    participant Feishu as Feishu Webhook

    GHProjects->>GHA: Emit item event (created/edited/archived/deleted/restored)
    GHA->>GHA: Sparse-checkout `scripts/notify` & create App token
    GHA->>Script: Execute `node scripts/notify/feishu-project-notify.mjs` (env + token)
    Script->>GraphQL: Query item details (node ID) using App token
    GraphQL-->>Script: Return item metadata and fields
    Script->>Script: Build change summary & Feishu card payload
    Script->>Feishu: POST interactive card to webhook URL
    Feishu-->>Script: Respond (success/error)
    Script-->>GHA: Exit with status
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • lefarcen
  • mrcfps

Poem

🐰 I hopped through events, quick and bright,

Cards stitched changes in morning light,
GraphQL crumbs led me along,
I sang a webhook, soft and strong,
Hooray — the project board sings tonight! 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description is comprehensive but does not follow the required template structure, lacking What/Why/How sections and the standard checklist. Reorganize the description to match the template with What, Why, How sections; fill in the checklist (typecheck, lint, test, generate-types, security, types) and affected areas checkboxes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: notify Feishu when GitHub Project draft items change' accurately summarizes the main change: adding Feishu notifications for GitHub Projects V2 item events.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/feishu-project-notify

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 69bc0bd55e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .github/workflows/feishu-project-item-notify.yml
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/feishu-project-item-notify.yml:
- Around line 3-5: The workflow's on: trigger uses the unsupported
projects_v2_item event (projects_v2_item with types [created, edited, archived,
deleted, restored]); remove or replace this trigger and instead either (A) set
up a repository webhook to forward projects_v2_item to an external endpoint and
use repository_dispatch to kick the workflow, (B) change the workflow trigger to
a supported event such as issues or pull_request and then have the job call the
GitHub REST/GraphQL API to query/update project v2 items, or (C) trigger via
schedule or manual workflow_dispatch and perform project v2 operations via
API—update the workflow header accordingly and document which approach you
choose.

In `@scripts/notify/feishu-project-notify.mjs`:
- Around line 215-236: The file has Biome formatting/whitespace/line-break
issues in the block around variables like contentAssignees, fieldAssignees,
assigneesText, status, priority, labels, itemUrl (buildProjectUrl), changeInfo
(buildStatusChangeText) and the actionText/headerColor extraction from
ACTION_CONFIG; run "biome format --write" on
scripts/notify/feishu-project-notify.mjs (or the repo root) to apply the
formatter and re-save the file so the pipeline passes formatting checks.
- Line 32: The declared constant repo (const repo = process.env.REPO ?? "") in
the script is unused and causing lint failures; either remove that declaration
entirely or start using repo in the notification payload (e.g., include it in
the message/body where other env vars are referenced). If you remove it, also
remove REPO from the workflow/env block to keep CI config clean. Update the
feishu-project-notify.mjs file by deleting the unused const repo line or wiring
repo into the notification construction, and mirror the removal in the workflow
env if unused.
- Around line 187-192: The buildProjectUrl function currently assumes org-owned
projects; update it to choose the correct URL pattern based on ownership by
reading a new boolean flag (e.g., IS_ORG_PROJECT from env or workflow input) and
using `/orgs/${orgOrUser}/projects/${projectNumber}` when true and
`/users/${orgOrUser}/projects/${projectNumber}` when false; ensure you reference
the existing symbols buildProjectUrl, orgOrUser and projectNumber and wire
IS_ORG_PROJECT into the script (or, alternatively, implement a fallback that
attempts both patterns) so user-owned projects resolve correctly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8329b132-144c-4071-a835-6dea2e1e11d4

📥 Commits

Reviewing files that changed from the base of the PR and between fdb0442 and 69bc0bd.

📒 Files selected for processing (2)
  • .github/workflows/feishu-project-item-notify.yml
  • scripts/notify/feishu-project-notify.mjs

Comment thread .github/workflows/feishu-project-item-notify.yml
Comment thread scripts/notify/feishu-project-notify.mjs Outdated
Comment thread scripts/notify/feishu-project-notify.mjs
Comment thread scripts/notify/feishu-project-notify.mjs Outdated
@qiongyu1999 qiongyu1999 changed the title feat: notify Feishu when GitHub Project draft items change chore: notify Feishu when GitHub Project draft items change Mar 25, 2026
@qiongyu1999 qiongyu1999 merged commit 363be71 into main Mar 25, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants