| 1 | import type { WebhookFormat } from './index.js'; |
| 2 | import { summaryOf } |
| 3 | |
| 4 | /** Google Chat incoming webhooks: https://developers.google.com/workspace/chat/quickstart/webhooks */ |
| 5 | export const googleChat: |
| 6 | matches: (url) |
| 7 | url.hostname === |
| 8 | url.pathname.startsWith |
| 9 | render: (message) |
| 10 | const summary = |
| 11 | return { |
| 12 | text: [ |
| 13 | `*${plain(message |
| 14 | message.url ? |
| 15 | ...message.commits. |
| 16 | (commit) => |
| 17 | `<${commit.url |
| 18 | ), |
| 19 | ...(message.moreCommits |
| 20 | ...(message.excerpt |
| 21 | ].join('\n' |
| 22 | }; |
| 23 | }, |
| 24 | }; |
| 25 | |
| 26 | // Chat has no escape for `<`: user text with `<users/all>` would page the space, so angle brackets become look-alikes. |
| 27 | function plain(text: |
| 28 | return text.replaceAll |
| 29 | } |