Get actual run date

This commit is contained in:
Rodel Calasagsag 2023-08-17 11:37:42 +08:00
parent c1771cb372
commit 876a0eb6b9
2 changed files with 17 additions and 6 deletions

View File

@ -1,4 +1,4 @@
module.exports = ( { core } ) => {
module.exports = async ( { context, core, github } ) => {
const {
API_RESULT,
E2E_RESULT,
@ -12,10 +12,21 @@ module.exports = ( { core } ) => {
readContextBlocksFromJsonFiles,
} = require( './utils' );
const create_blockGroup_header = () => {
const date = new Intl.DateTimeFormat( 'en-US', {
const create_blockGroup_header = async () => {
const response = await github.rest.actions.getWorkflowRun( {
owner: context.repo.owner,
repo: context.repo.repo,
run_id: GITHUB_RUN_ID,
} );
const runStartedAt = new Date( response.data.run_started_at );
const intlDateTimeFormatOptions = {
dateStyle: 'full',
} ).format( Date.now() );
timeStyle: 'long',
};
const date = new Intl.DateTimeFormat(
'en-US',
intlDateTimeFormatOptions
).format( runStartedAt );
const blocks = [
{
@ -103,7 +114,7 @@ module.exports = ( { core } ) => {
return blocks;
};
const blockGroup_header = create_blockGroup_header();
const blockGroup_header = await create_blockGroup_header();
const blockGroup_nightlySite = create_blockGroup_nightlySite();
const blockGroups_plugins =
readContextBlocksFromJsonFiles( PLUGINS_BLOCKS_PATH );

View File

@ -369,7 +369,7 @@ jobs:
with:
script: |
const script = require('./.github/actions/tests/slack-summary-daily/scripts/construct-slack-payload.js');
script( { core } );
await script( { context, core, github } );
env:
API_RESULT: ${{ needs.api-tests.outputs.test-result }}
E2E_RESULT: ${{ needs.e2e-tests.outputs.test-result }}