From 88c1eaa5348899537491bfb071816f191491f6fc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Jul 2026 07:43:46 +0000 Subject: [PATCH 1/8] Initial plan From cc02a8c73f175e045f575bb1a31fd61b7f47d584 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Jul 2026 07:46:20 +0000 Subject: [PATCH 2/8] feat: track Node LTS in action runtime --- __tests__/main.test.ts | 28 +++++++++++++++++++++++----- action.yml | 14 ++++++++++++-- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 951bd9a..0f504ae 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -1,8 +1,26 @@ -import * as process from 'process' -import * as cp from 'child_process' +import * as fs from 'fs' import * as path from 'path' +import yaml from 'js-yaml' -// shows how the runner will run a javascript action with env / stdout protocol -test('test runs', () => { - console.log('just test') +test('action uses setup-node lts in composite wrapper', () => { + const actionPath = path.join(__dirname, '..', 'action.yml') + const action = yaml.load(fs.readFileSync(actionPath, 'utf8')) as { + runs: { + using: string + steps: Array<{ + uses?: string + with?: { + 'node-version'?: string + } + }> + } + } + + expect(action.runs.using).toBe('composite') + expect(action.runs.steps[0]).toMatchObject({ + uses: 'actions/setup-node@v4', + with: { + 'node-version': 'lts/*' + } + }) }) diff --git a/action.yml b/action.yml index 12a6add..51a664f 100644 --- a/action.yml +++ b/action.yml @@ -24,8 +24,18 @@ inputs: See: https://open.feishu.cn/document/feishu-cards/quick-start/send-message-cards-with-custom-bot runs: - using: 'node20' - main: 'dist/index.js' + using: 'composite' + steps: + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - shell: pwsh + working-directory: ${{ github.action_path }} + env: + INPUT_URL: ${{ inputs.url }} + INPUT_MSG_TYPE: ${{ inputs.msg_type }} + INPUT_CONTENT: ${{ inputs.content }} + run: node dist/index.js branding: color: 'blue' From c5ac7ed4b365e1261da20cd25345ba4358fb9100 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Jul 2026 07:47:44 +0000 Subject: [PATCH 3/8] fix: improve composite action shell compatibility --- __tests__/main.test.ts | 4 +++- action.yml | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 0f504ae..aa00eef 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -4,7 +4,9 @@ import yaml from 'js-yaml' test('action uses setup-node lts in composite wrapper', () => { const actionPath = path.join(__dirname, '..', 'action.yml') - const action = yaml.load(fs.readFileSync(actionPath, 'utf8')) as { + const action = yaml.load(fs.readFileSync(actionPath, 'utf8'), { + schema: yaml.JSON_SCHEMA + }) as { runs: { using: string steps: Array<{ diff --git a/action.yml b/action.yml index 51a664f..1fb059b 100644 --- a/action.yml +++ b/action.yml @@ -29,7 +29,16 @@ runs: - uses: actions/setup-node@v4 with: node-version: 'lts/*' - - shell: pwsh + - if: runner.os == 'Windows' + shell: pwsh + working-directory: ${{ github.action_path }} + env: + INPUT_URL: ${{ inputs.url }} + INPUT_MSG_TYPE: ${{ inputs.msg_type }} + INPUT_CONTENT: ${{ inputs.content }} + run: node dist/index.js + - if: runner.os != 'Windows' + shell: bash working-directory: ${{ github.action_path }} env: INPUT_URL: ${{ inputs.url }} From 1841229c671457a37df24e6d26b3c169e0621b5c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Jul 2026 07:49:03 +0000 Subject: [PATCH 4/8] refactor: simplify composite action shell step --- __tests__/main.test.ts | 4 ++++ action.yml | 11 +---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index aa00eef..d0f8b8f 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -25,4 +25,8 @@ test('action uses setup-node lts in composite wrapper', () => { 'node-version': 'lts/*' } }) + expect(action.runs.steps[1]).toMatchObject({ + shell: "${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}", + run: 'node dist/index.js' + }) }) diff --git a/action.yml b/action.yml index 1fb059b..58be905 100644 --- a/action.yml +++ b/action.yml @@ -29,16 +29,7 @@ runs: - uses: actions/setup-node@v4 with: node-version: 'lts/*' - - if: runner.os == 'Windows' - shell: pwsh - working-directory: ${{ github.action_path }} - env: - INPUT_URL: ${{ inputs.url }} - INPUT_MSG_TYPE: ${{ inputs.msg_type }} - INPUT_CONTENT: ${{ inputs.content }} - run: node dist/index.js - - if: runner.os != 'Windows' - shell: bash + - shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} working-directory: ${{ github.action_path }} env: INPUT_URL: ${{ inputs.url }} From ff2bd8cc5683ba7f48240e12b4a3d2e0586b2072 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Jul 2026 07:50:33 +0000 Subject: [PATCH 5/8] chore: clarify composite action metadata --- __tests__/main.test.ts | 5 +++-- action.yml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index d0f8b8f..91b52ef 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -5,7 +5,7 @@ import yaml from 'js-yaml' test('action uses setup-node lts in composite wrapper', () => { const actionPath = path.join(__dirname, '..', 'action.yml') const action = yaml.load(fs.readFileSync(actionPath, 'utf8'), { - schema: yaml.JSON_SCHEMA + schema: yaml.FAILSAFE_SCHEMA }) as { runs: { using: string @@ -26,7 +26,8 @@ test('action uses setup-node lts in composite wrapper', () => { } }) expect(action.runs.steps[1]).toMatchObject({ - shell: "${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}", + shell: + "${{ runner.os == 'Windows' && 'pwsh' || ((runner.os == 'Linux' || runner.os == 'macOS') && 'bash') }}", run: 'node dist/index.js' }) }) diff --git a/action.yml b/action.yml index 58be905..345679c 100644 --- a/action.yml +++ b/action.yml @@ -29,7 +29,7 @@ runs: - uses: actions/setup-node@v4 with: node-version: 'lts/*' - - shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} + - shell: ${{ runner.os == 'Windows' && 'pwsh' || ((runner.os == 'Linux' || runner.os == 'macOS') && 'bash') }} working-directory: ${{ github.action_path }} env: INPUT_URL: ${{ inputs.url }} From 06d1c18d32c587008dc0de1bc5c22d15ee6772aa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Jul 2026 07:55:52 +0000 Subject: [PATCH 6/8] chore: address Node LTS review feedback --- __tests__/main.test.ts | 26 ++++++++++++++------------ action.yml | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 91b52ef..c951fef 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -2,25 +2,27 @@ import * as fs from 'fs' import * as path from 'path' import yaml from 'js-yaml' +type ActionMetadata = { + runs: { + using: string + steps: { + uses?: string + with?: {'node-version'?: string} + shell?: string + run?: string + }[] + } +} + test('action uses setup-node lts in composite wrapper', () => { const actionPath = path.join(__dirname, '..', 'action.yml') const action = yaml.load(fs.readFileSync(actionPath, 'utf8'), { schema: yaml.FAILSAFE_SCHEMA - }) as { - runs: { - using: string - steps: Array<{ - uses?: string - with?: { - 'node-version'?: string - } - }> - } - } + }) as ActionMetadata expect(action.runs.using).toBe('composite') expect(action.runs.steps[0]).toMatchObject({ - uses: 'actions/setup-node@v4', + uses: 'actions/setup-node@v7', with: { 'node-version': 'lts/*' } diff --git a/action.yml b/action.yml index 345679c..3853c28 100644 --- a/action.yml +++ b/action.yml @@ -26,7 +26,7 @@ inputs: runs: using: 'composite' steps: - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v7 with: node-version: 'lts/*' - shell: ${{ runner.os == 'Windows' && 'pwsh' || ((runner.os == 'Linux' || runner.os == 'macOS') && 'bash') }} From 4f37b483738bcb71a718736db4c97def2ac1d0ec Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Jul 2026 08:00:43 +0000 Subject: [PATCH 7/8] chore: bump @types/node for Node LTS update --- package.json | 2 +- yarn.lock | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 1924cc8..2629f53 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "devDependencies": { "@types/jest": "^29.5.14", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.17.9", + "@types/node": "^24.13.3", "@typescript-eslint/eslint-plugin": "^8.17.0", "@typescript-eslint/parser": "^8.17.0", "@vercel/ncc": "^0.38.3", diff --git a/yarn.lock b/yarn.lock index 745b63e..d360d4b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -808,12 +808,12 @@ dependencies: undici-types "~7.16.0" -"@types/node@^20.17.9": - version "20.19.25" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.19.25.tgz#467da94a2fd966b57cc39c357247d68047611190" - integrity sha512-ZsJzA5thDQMSQO788d7IocwwQbI8B5OPzmqNvpf3NY/+MHDAS759Wo0gd2WQeXYt5AAAQjzcrTVC6SKCuYgoCQ== +"@types/node@^24.13.3": + version "24.13.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.13.3.tgz#49f18bd3c647866dcda51a0756c145e14590ce16" + integrity sha512-Dh8vAsV36ig5wa9OX4pXvMc9D3Veibfw2wix0CUwYODLD8nkj9UsLjASr49nPg+2eKzxhBV+v7L8pXvT4e639Q== dependencies: - undici-types "~6.21.0" + undici-types "~7.18.0" "@types/responselike@^1.0.0": version "1.0.3" @@ -4073,16 +4073,16 @@ unbox-primitive@^1.1.0: has-symbols "^1.1.0" which-boxed-primitive "^1.1.1" -undici-types@~6.21.0: - version "6.21.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb" - integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ== - undici-types@~7.16.0: version "7.16.0" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.16.0.tgz#ffccdff36aea4884cbfce9a750a0580224f58a46" integrity sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw== +undici-types@~7.18.0: + version "7.18.2" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.18.2.tgz#29357a89e7b7ca4aef3bf0fd3fd0cd73884229e9" + integrity sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w== + undici@^5.25.4: version "5.29.0" resolved "https://registry.yarnpkg.com/undici/-/undici-5.29.0.tgz#419595449ae3f2cdcba3580a2e8903399bd1f5a3" From b47d9a61fc901c313943acdc92d5854bb7744451 Mon Sep 17 00:00:00 2001 From: TechQuery Date: Sat, 25 Jul 2026 16:22:27 +0800 Subject: [PATCH 8/8] [optimize] update Lark-GitHub-action & other Upstream actions --- .github/scripts/transform-message.ts | 48 +++++++++++++------------ .github/workflows/Lark-notification.yml | 8 ++--- .github/workflows/test.yml | 4 +-- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/scripts/transform-message.ts b/.github/scripts/transform-message.ts index 9a4d1b4..a1ebe64 100644 --- a/.github/scripts/transform-message.ts +++ b/.github/scripts/transform-message.ts @@ -37,10 +37,8 @@ const ACTION_TEXT_MAP: Record = { review_requested: "请求审核", }; -const getActionText = (action?: string) => { - if (!action) return "编辑"; - return ACTION_TEXT_MAP[action] || action; -}; +const getActionText = (action?: string) => + action ? ACTION_TEXT_MAP[action] || action : "编辑"; const createLink = (href: string, text = href) => `[${text}](${href})`; @@ -74,12 +72,17 @@ const sanitizeMarkdown = (text: string): string => const createContentItem = (label: string, value?: string) => `**${label}** ${value ? sanitizeMarkdown(value) : "无"}`; +interface LarkMessageElement { + tag: string; + content: string | [object, object][]; +} + type EventHandler = ( event: GitHubAction, - actionText: string, + actionText: string ) => { title: string; - elements: any[]; + elements: LarkMessageElement[]; }; // Event handlers @@ -92,10 +95,10 @@ const eventHandlers: Record = { repository, actor, }) => { - const commitUrl = head_commit?.url || - `${server_url}/${repository}/tree/${ref_name}`; - const commitMessage = head_commit?.message || - "Create/Delete/Update Branch (No head commit)"; + const commitUrl = + head_commit?.url || `${server_url}/${repository}/tree/${ref_name}`; + const commitMessage = + head_commit?.message || "Create/Delete/Update Branch (No head commit)"; return { title: "GitHub 代码提交", @@ -108,12 +111,12 @@ const eventHandlers: Record = { "代码分支:", createLink( `${server_url}/${repository}/tree/${ref_name}`, - ref_name, - ), + ref_name + ) ), createContentItem( "提交作者:", - createLink(`${server_url}/${actor}`, actor), + createLink(`${server_url}/${actor}`, actor) ), createContentItem("提交信息:", commitMessage), ].join("\n"), @@ -132,11 +135,11 @@ const eventHandlers: Record = { createContentItem("作者:", createUserLink(issue!.user!)), createContentItem( "指派:", - issue?.assignee ? createUserLink(issue.assignee) : "无", + issue?.assignee ? createUserLink(issue.assignee) : "无" ), createContentItem( "标签:", - issue?.labels?.map(({ name }) => name).join(", ") || "无", + issue?.labels?.map(({ name }) => name).join(", ") || "无" ), createContentItem("里程碑:", issue?.milestone?.title || "无"), createContentItem("描述:", issue?.body || "无"), @@ -157,11 +160,11 @@ const eventHandlers: Record = { "指派:", pull_request?.assignee ? createUserLink(pull_request.assignee) - : "无", + : "无" ), createContentItem( "标签:", - pull_request?.labels?.map(({ name }) => name).join(", ") || "无", + pull_request?.labels?.map(({ name }) => name).join(", ") || "无" ), createContentItem("里程碑:", pull_request?.milestone?.title || "无"), createContentItem("描述:", pull_request?.body || "无"), @@ -179,7 +182,7 @@ const eventHandlers: Record = { createContentItem("链接:", createLink(discussion!.html_url)), createContentItem( "作者:", - createUserLink(discussion!.user as GitHubUser), + createUserLink(discussion!.user as GitHubUser) ), createContentItem("描述:", discussion?.body || "无"), ].join("\n"), @@ -239,7 +242,7 @@ const eventHandlers: Record = { createContentItem("作者:", createUserLink(comment!.user!)), createContentItem( "PR:", - createLink(pull_request!.html_url, `#${pull_request!.number}`), + createLink(pull_request!.html_url, `#${pull_request!.number}`) ), createContentItem("评论:", comment?.body || "无"), ].join("\n"), @@ -261,7 +264,7 @@ const processEvent = (event: GitHubAction) => { } catch (cause) { throw new Error( `Error processing ${event_name} event: ${(cause as Error).message}`, - { cause }, + { cause } ); } }; @@ -270,11 +273,10 @@ const processEvent = (event: GitHubAction) => { const event = JSON.parse((await stdin()) || "{}") as GitHubAction; const result = processEvent(event); -if (!result) { +if (!result) throw new Error( - `Unsupported ${event.event_name} event & ${event.action} action`, + `Unsupported ${event.event_name} event & ${event.action} action` ); -} const card = { schema: "2.0", diff --git a/.github/workflows/Lark-notification.yml b/.github/workflows/Lark-notification.yml index 5aeae0f..0d3dc40 100644 --- a/.github/workflows/Lark-notification.yml +++ b/.github/workflows/Lark-notification.yml @@ -25,12 +25,10 @@ jobs: - name: Event Message serialization id: message + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} run: | - YAML=$( - cat <<'JSON' | deno run --allow-all .github/scripts/transform-message.ts - ${{ toJSON(github) }} - JSON - ) + YAML=$(printf '%s' "$GITHUB_CONTEXT" | deno run --allow-all .github/scripts/transform-message.ts) { echo 'content<