From 269d8bb0e1fa5bcf518b1d14c196509e019b3840 Mon Sep 17 00:00:00 2001 From: Connor Davis Date: Tue, 11 Jul 2023 09:42:05 -0400 Subject: [PATCH] Add more icons to GitHub messages (#795) * Add more icons to GitHub messages * Add merged icon * Lint * Add changelog --- changelog.d/795.feature | 1 + src/Connections/GithubRepo.ts | 37 +++++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 changelog.d/795.feature diff --git a/changelog.d/795.feature b/changelog.d/795.feature new file mode 100644 index 00000000..0a32cff8 --- /dev/null +++ b/changelog.d/795.feature @@ -0,0 +1 @@ +Add more icons to GitHub repo hooks \ No newline at end of file diff --git a/src/Connections/GithubRepo.ts b/src/Connections/GithubRepo.ts index 15e3284b..1a62a18f 100644 --- a/src/Connections/GithubRepo.ts +++ b/src/Connections/GithubRepo.ts @@ -885,7 +885,8 @@ export class GitHubRepoConnection extends CommandConnection TRUNCATE_COMMENT_SIZE ? "…" : ""); await this.intent.sendEvent(this.roomId, { @@ -960,7 +962,8 @@ export class GitHubRepoConnection extends CommandConnection ({ name: l.name, description: l.description || undefined, color: l.color || undefined }))); - const content = `**${event.sender.login}** labeled issue [${orgRepoName}#${event.issue.number}](${event.issue.html_url}): "${emoji.emojify(event.issue.title)}"`; + const icon = '🗃'; + const content = emoji.emojify(`${icon} **${event.sender.login}** labeled issue [${orgRepoName}#${event.issue.number}](${event.issue.html_url}): "${emoji.emojify(event.issue.title)}"`); this.intent.sendEvent(this.roomId, { msgtype: "m.notice", body: content + (plain.length > 0 ? ` with labels ${plain}`: ""), @@ -1067,7 +1072,8 @@ export class GitHubRepoConnection extends CommandConnection${diff.data}\n`; } } - const content = emoji.emojify(`**${event.sender.login}** ${verb} a new PR [${orgRepoName}#${event.pull_request.number}](${event.pull_request.html_url}): "${event.pull_request.title}"`); + const icon = verb === 'opened' ? '🔵' : '⚪'; + const content = emoji.emojify(`${icon} **${event.sender.login}** ${verb} a new PR [${orgRepoName}#${event.pull_request.number}](${event.pull_request.html_url}): "${event.pull_request.title}"`); const labels = FormatUtil.formatLabels(event.pull_request.labels?.map(l => ({ name: l.name, description: l.description || undefined, color: l.color || undefined }))); await this.intent.sendEvent(this.roomId, { msgtype: "m.notice", @@ -1091,7 +1097,8 @@ export class GitHubRepoConnection extends CommandConnection