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

41 lines
811 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-15 08:53:29 +00:00
2023-08-16 00:14:22 +00:00
const block = {
type: 'context',
elements: [
{
type: 'mrkdwn',
text: PLUGIN_NAME,
},
{
type: 'mrkdwn',
text: ' ',
},
{
type: 'mrkdwn',
text: ' ',
},
{
type: 'mrkdwn',
text: `Upload test ${ emoji_UPLOAD }`,
},
{
type: 'mrkdwn',
text: `E2E ${ emoji_E2E }`,
},
],
};
const block_stringified = JSON.stringify( block );
2023-08-15 08:53:29 +00:00
2023-08-16 00:14:22 +00:00
const path = `/tmp/${ PLUGIN_SLUG }.json`;
fs.writeFileSync( path, block_stringified );
2023-08-15 08:53:29 +00:00
2023-08-16 00:14:22 +00:00
core.setOutput( 'path', path );
};