mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-22 04:11:30 +03:00
20 lines
581 B
JavaScript
20 lines
581 B
JavaScript
|
import { WebClient } from '@slack/web-api';
|
||
|
|
||
|
import { render } from './markdown.js';
|
||
|
|
||
|
const { CHANNEL_ID, SLACK_BOT_TOKEN, COPILOT_RESULT, BRANCH_SHA, BRANCH_NAME } =
|
||
|
process.env;
|
||
|
|
||
|
const { ok } = await new WebClient(SLACK_BOT_TOKEN).chat.postMessage({
|
||
|
channel: CHANNEL_ID,
|
||
|
text: `AFFiNE Copilot Test ${COPILOT_RESULT}`,
|
||
|
blocks: render(
|
||
|
`# AFFiNE Copilot Test ${COPILOT_RESULT}
|
||
|
|
||
|
- [${BRANCH_NAME?.replace('refs/heads/', '') || BRANCH_SHA}](https://github.com/toeverything/AFFiNE/commit/${BRANCH_SHA})
|
||
|
`
|
||
|
),
|
||
|
});
|
||
|
|
||
|
console.assert(ok, 'Failed to send a message to Slack');
|