diff --git a/packages/plugin-github/src/events.ts b/packages/plugin-github/src/events.ts index cf800987e4..4ce1e2184c 100644 --- a/packages/plugin-github/src/events.ts +++ b/packages/plugin-github/src/events.ts @@ -242,6 +242,8 @@ export function addListeners(on: (event: T, handler: Eve close: [issue_url], link: [html_url], merge: [url + '/merge'], + rebase: [url + '/merge'], + squash: [url + '/merge'], react: [issue_url + `/reactions`], reply: [comments_url], ...replies, diff --git a/packages/plugin-github/src/server.ts b/packages/plugin-github/src/server.ts index fbc460197e..64838db488 100644 --- a/packages/plugin-github/src/server.ts +++ b/packages/plugin-github/src/server.ts @@ -175,7 +175,7 @@ export class ReplyHandler { }) } - merge(url: string) { + merge(url: string, method?: 'merge' | 'squash' | 'rebase') { const [title] = this.content.split('\n', 1) const message = this.content.slice(title.length) return this.github.request({ @@ -183,12 +183,21 @@ export class ReplyHandler { method: 'PUT', session: this.session, body: { + merge_method: method, commit_title: title.trim(), commit_message: message.trim(), }, }) } + rebase(url: string) { + return this.merge(url, 'rebase') + } + + squash(url: string) { + return this.merge(url, 'squash') + } + async close(url: string) { if (this.content) await this.reply(url) await this.github.request({