Skip to content

[add] GitHub action for Lark notification#7

Merged
TechQuery merged 1 commit into
mainfrom
Lark-bot
Jun 6, 2026
Merged

[add] GitHub action for Lark notification#7
TechQuery merged 1 commit into
mainfrom
Lark-bot

Conversation

@TechQuery

@TechQuery TechQuery commented Jun 6, 2026

Copy link
Copy Markdown
Member

PR-7 PR-7 PR-7 Powered by Pull Request Badge

Copilot AI review requested due to automatic review settings June 6, 2026 23:30
@TechQuery TechQuery requested a review from FenjuFu June 6, 2026 23:30
@TechQuery TechQuery added the enhancement Some improvements label Jun 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds an event-driven GitHub Actions workflow that posts interactive Lark (Feishu) bot notifications, using a Deno/TypeScript script to transform the github context payload into a Lark card.

Changes:

  • Introduces .github/workflows/Lark-notification.yml to trigger on common repo events and send Lark notifications.
  • Adds .github/scripts/transform-message.ts to format GitHub event payloads into a Lark interactive card payload.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
.github/workflows/Lark-notification.yml New workflow to serialize GitHub event context and send it to Lark via Open-Source-Bazaar/feishu-action.
.github/scripts/transform-message.ts New Deno script that maps GitHub event types to Lark card titles/content and outputs a card payload.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +15 to +18

jobs:
send-Lark-message:
runs-on: ubuntu-latest
Comment on lines +31 to +36
YAML=$(printf '%s' "$GITHUB_CONTEXT" | deno run --allow-all .github/scripts/transform-message.ts)
{
echo 'content<<EOF'
echo "$YAML"
echo 'EOF'
} >> "$GITHUB_OUTPUT"
Comment on lines +100 to +103
const commitUrl =
head_commit?.url || `${server_url}/${repository}/tree/${ref_name}`;
const commitMessage =
head_commit?.message || 'Create/Delete/Update Branch (No head commit)';
Comment on lines +51 to +72
const sanitizeMarkdown = (text: string): string =>
text
// Remove code blocks
.replace(/```[\s\S]*?```/g, '[代码块]')
// Remove inline code
.replace(/`[^`]+`/g, (match) => match.slice(1, -1))
// Convert images to link text
.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '🖼️ [$1]($2)')
// Convert ### headers to bold
.replace(/^###\s+(.+)$/gm, '**$1**')
// Convert ## headers to bold
.replace(/^##\s+(.+)$/gm, '**$1**')
// Convert # headers to bold
.replace(/^#\s+(.+)$/gm, '**$1**')
// Remove HTML comments
.replace(/<!--[\s\S]*?-->/g, '')
// Remove HTML tags (keep content)
.replace(/<[^>]+>/g, '')
// Remove excess empty lines
.replace(/\n{3,}/g, '\n\n')
// Truncate long content
.slice(0, 800) + (text.length > 800 ? '\n...' : '');
Comment on lines +77 to +80
interface LarkMessageElement {
tag: string;
content: string | [object, object][];
}
@TechQuery TechQuery merged commit d717cc5 into main Jun 6, 2026
4 checks passed
@TechQuery TechQuery deleted the Lark-bot branch June 6, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Some improvements

Projects

Development

Successfully merging this pull request may close these issues.

2 participants