woocommerce/.github/actions/tests/slack-summary-daily/scripts/create-blocks-plugin-tests.js

38 lines
927 B
JavaScript
Raw Normal View History

2023-08-16 00:14:22 +00:00
module.exports = ( { core } ) => {
const { UPLOAD_RESULT, E2E_RESULT, PLUGIN_NAME, PLUGIN_SLUG } = process.env;
const { selectEmoji } = require( './utils' );
const fs = require( 'fs' );
2023-08-15 08:53:29 +00:00
2023-08-16 00:14:22 +00:00
const emoji_UPLOAD = selectEmoji( UPLOAD_RESULT );
const emoji_E2E = selectEmoji( E2E_RESULT );
2023-08-23 00:46:17 +00:00
const reportURL = `https://woocommerce.github.io/woocommerce-test-reports/daily/${ PLUGIN_SLUG }/e2e`;
2023-08-15 08:53:29 +00:00
2023-08-16 04:47:25 +00:00
const blockGroup = [
{
type: 'section',
text: {
2023-08-16 00:14:22 +00:00
type: 'mrkdwn',
2023-08-23 00:46:17 +00:00
text: `<${ reportURL }|*${ PLUGIN_NAME }*>`,
2023-08-16 00:14:22 +00:00
},
2023-08-16 04:47:25 +00:00
},
{
type: 'context',
elements: [
{
type: 'mrkdwn',
text: `"Upload plugin" test ${ emoji_UPLOAD }\tOther E2E tests ${ emoji_E2E }`,
},
],
},
{
type: 'divider',
},
];
const blockGroup_stringified = JSON.stringify( blockGroup );
2023-08-15 08:53:29 +00:00
2023-08-16 00:14:22 +00:00
const path = `/tmp/${ PLUGIN_SLUG }.json`;
2023-08-16 04:47:25 +00:00
fs.writeFileSync( path, blockGroup_stringified );
2023-08-15 08:53:29 +00:00
2023-08-16 00:14:22 +00:00
core.setOutput( 'path', path );
};