2023-08-16 00:14:22 +00:00
|
|
|
module.exports = ( { core } ) => {
|
|
|
|
const { API_RESULT, E2E_RESULT, k6_RESULT, PLUGINS_BLOCKS_PATH } =
|
|
|
|
process.env;
|
|
|
|
const {
|
|
|
|
selectEmoji,
|
|
|
|
readContextBlocksFromJsonFiles,
|
|
|
|
} = require( './utils' );
|
2023-08-15 08:53:29 +00:00
|
|
|
|
2023-08-16 00:14:22 +00:00
|
|
|
const block_header = {
|
|
|
|
type: 'header',
|
|
|
|
text: {
|
|
|
|
type: 'plain_text',
|
|
|
|
text: 'Daily test results',
|
|
|
|
emoji: true,
|
|
|
|
},
|
|
|
|
};
|
2023-08-15 08:53:29 +00:00
|
|
|
|
2023-08-16 00:14:22 +00:00
|
|
|
const emoji_API = selectEmoji( API_RESULT );
|
|
|
|
const emoji_E2E = selectEmoji( E2E_RESULT );
|
|
|
|
const emoji_k6 = selectEmoji( k6_RESULT );
|
2023-08-15 08:53:29 +00:00
|
|
|
|
2023-08-16 00:14:22 +00:00
|
|
|
const block_nightlySite = {
|
|
|
|
type: 'context',
|
|
|
|
elements: [
|
|
|
|
{
|
|
|
|
type: 'mrkdwn',
|
|
|
|
text: '*Smoke tests on daily build*',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'mrkdwn',
|
|
|
|
text: ' ',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'mrkdwn',
|
|
|
|
text: ' ',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'mrkdwn',
|
|
|
|
text: `API ${ emoji_API }`,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'mrkdwn',
|
|
|
|
text: `E2E ${ emoji_E2E }`,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'mrkdwn',
|
|
|
|
text: `k6 ${ emoji_k6 }`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
2023-08-15 08:53:29 +00:00
|
|
|
|
2023-08-16 00:14:22 +00:00
|
|
|
const blocks_plugins =
|
|
|
|
readContextBlocksFromJsonFiles( PLUGINS_BLOCKS_PATH );
|
2023-08-15 08:53:29 +00:00
|
|
|
|
2023-08-16 00:14:22 +00:00
|
|
|
const payload = {
|
|
|
|
blocks: [ block_header, block_nightlySite, ...blocks_plugins ],
|
|
|
|
};
|
2023-08-15 08:53:29 +00:00
|
|
|
|
2023-08-16 00:14:22 +00:00
|
|
|
const payload_stringified = JSON.stringify( payload );
|
2023-08-15 08:53:29 +00:00
|
|
|
|
2023-08-16 01:07:56 +00:00
|
|
|
core.setOutput( 'payload', payload_stringified );
|
2023-08-16 00:14:22 +00:00
|
|
|
};
|