dx: comment on custom parser pr fix (#278)

* dx: comment on custom parser pr fix

* fix path

* write json

* chore: rename comment script
pull/301/head
Adam Pash 5 years ago committed by GitHub
parent ed14203e97
commit 9698d9a0c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

File diff suppressed because one or more lines are too long

@ -3,6 +3,7 @@ const bot = require('@jesses/circle-github-bot').default.create();
const Mercury = require('../dist/mercury.js');
const fs = require('fs');
const getTestReport = require('./get-test-report');
const execSync = require('child_process').execSync;
const run = () => {
const screenshotPath = process.argv[2];
@ -38,19 +39,17 @@ const run = () => {
const testReport =
getTestReport('./test-output.json') || '✅ All tests passed';
bot.comment(
process.env.GH_AUTH_TOKEN,
`### 🤖 Automated Parsing Preview 🤖
const comment = `### 🤖 Automated Parsing Preview 🤖
**Commit:** \`${bot.env.commitMessage}\`
![Screenshot of fixture (this embed should work after repo is public)](${bot.artifactUrl(
screenshotPath
)})
screenshotPath
)})
[Original Article](${url}) | ${bot.artifactLink(
fixtureArtifactPath,
'HTML Fixture'
)} | ${bot.artifactLink(previewPath, 'Parsed Content Preview')}
fixtureArtifactPath,
'HTML Fixture'
)} | ${bot.artifactLink(previewPath, 'Parsed Content Preview')}
<details>
<summary><b>Parsed JSON</b></summary>
@ -66,12 +65,19 @@ ${JSON.stringify(json, null, 2)}
**\`null\` fields**
${Object.keys(json)
.map(key => (json[key] !== null ? '' : ` * \`${key}\n\``))
.join('\n\n') || 'None'}
.map(key => (json[key] !== null ? '' : ` * \`${key}\n\``))
.join('\n\n') || 'None'}
${testReport}
`
`;
const commentPath = 'tmp/artifacts/comment.json';
fs.writeFileSync(
commentPath,
JSON.stringify({
body: comment,
issue: process.env.CIRCLE_PULL_REQUEST,
})
);
});
}

@ -20,7 +20,7 @@ if [[ $fixtures ]]; then
do
# Create a comment with a link to the screenshot
# and json output for the fixture
node scripts/comment-on-pr.js $screenshot
node scripts/comment-for-pr.js $screenshot
done
else
echo "No fixtures added in this PR, so no preview needed"

Loading…
Cancel
Save