diff --git a/packages/plugin-github/src/events.ts b/packages/plugin-github/src/events.ts index 7d27cb75ce..bd9a6689e8 100644 --- a/packages/plugin-github/src/events.ts +++ b/packages/plugin-github/src/events.ts @@ -103,12 +103,15 @@ export function addListeners(on: (event: T, handler: E }) on('pull_request.opened', ({ repository, pull_request }) => { - const { full_name } = repository + const { full_name, owner } = repository const { user, html_url, issue_url, comments_url, base, head, body, number } = pull_request if (user.type === 'bot') return + const prefix = new RegExp(`^${owner.login}:`) + const baseLabel = base.label.replace(prefix, '') + const headLabel = head.label.replace(prefix, '') return [[ - `[GitHub] ${user.login} opened a pull request ${full_name}#${number} (${base.label} <- ${head.label})`, + `[GitHub] ${user.login} opened a pull request ${full_name}#${number} (${baseLabel} <- ${headLabel})`, formatMarkdown(body), ].join('\n'), { link: html_url, diff --git a/packages/plugin-github/tests/index.snap.js b/packages/plugin-github/tests/index.snap.js index d16a678a00..fe285f55c5 100644 --- a/packages/plugin-github/tests/index.snap.js +++ b/packages/plugin-github/tests/index.snap.js @@ -25,12 +25,12 @@ Ich verstecke Englisch und Chinesisch nicht! Gab es Personen, die mir helfen kan // URL: https://github.com/koishijs/koishi/pull/20 module.exports[`pull_request.opened.1`] = ` -[GitHub] simon300000 opened a pull request koishijs/koishi#20 (koishijs:develop <- koishijs:experimental) +[GitHub] simon300000 opened a pull request koishijs/koishi#20 (develop <- experimental) Das ist wichtig!` // URL: https://github.com/koishijs/koishi/pull/90 module.exports[`pull_request.opened.2`] = ` -[GitHub] jjyyxx opened a pull request koishijs/koishi#90 (koishijs:mapping <- jjyyxx:mapping) +[GitHub] jjyyxx opened a pull request koishijs/koishi#90 (mapping <- jjyyxx:mapping) According to \`tsconfig-paths\` documentation ...` // URL: https://github.com/koishijs/koishi/pull/20#pullrequestreview-345349537