@@ -3,6 +3,7 @@ const bot = require('@jesses/circle-github-bot').default.create();
33const Mercury = require ( '../dist/mercury.js' ) ;
44const fs = require ( 'fs' ) ;
55const getTestReport = require ( './get-test-report' ) ;
6+ const execSync = require ( 'child_process' ) . execSync ;
67
78const run = ( ) => {
89 const screenshotPath = process . argv [ 2 ] ;
@@ -38,19 +39,17 @@ const run = () => {
3839 const testReport =
3940 getTestReport ( './test-output.json' ) || '✅ All tests passed' ;
4041
41- bot . comment (
42- process . env . GH_AUTH_TOKEN ,
43- `### 🤖 Automated Parsing Preview 🤖
42+ const comment = `### 🤖 Automated Parsing Preview 🤖
4443**Commit:** \`${ bot . env . commitMessage } \`
4544
4645 } )
46+ screenshotPath
47+ ) } )
4948
5049[Original Article](${ url } ) | ${ bot . artifactLink (
51- fixtureArtifactPath ,
52- 'HTML Fixture'
53- ) } | ${ bot . artifactLink ( previewPath , 'Parsed Content Preview' ) }
50+ fixtureArtifactPath ,
51+ 'HTML Fixture'
52+ ) } | ${ bot . artifactLink ( previewPath , 'Parsed Content Preview' ) }
5453
5554<details>
5655<summary><b>Parsed JSON</b></summary>
@@ -66,12 +65,19 @@ ${JSON.stringify(json, null, 2)}
6665**\`null\` fields**
6766
6867${ Object . keys ( json )
69- . map ( key => ( json [ key ] !== null ? '' : ` * \`${ key } \n\`` ) )
70- . join ( '\n\n' ) || 'None' }
68+ . map ( key => ( json [ key ] !== null ? '' : ` * \`${ key } \n\`` ) )
69+ . join ( '\n\n' ) || 'None' }
7170
7271
7372${ testReport }
74- `
73+ ` ;
74+ const commentPath = 'tmp/artifacts/comment.json' ;
75+ fs . writeFileSync (
76+ commentPath ,
77+ JSON . stringify ( {
78+ body : comment ,
79+ issue : process . env . CIRCLE_PULL_REQUEST ,
80+ } )
7581 ) ;
7682 } ) ;
7783 }
0 commit comments