Only add a mypy_primer comment if there is output (#4725)

This commit is contained in:
Sebastian Rittau
2020-10-28 20:07:12 +01:00
committed by GitHub
parent 96d7d77a04
commit c5aca0d533

View File

@@ -45,12 +45,14 @@ jobs:
const fs = require('fs').promises;
try {
data = await fs.readFile('diff.txt', 'utf-8')
await github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Diff from [mypy_primer](https://github.com/hauntsaninja/mypy_primer), showing the effect of this PR on open source code:\n```diff\n' + data + '```'
})
if (data.trim()) {
await github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Diff from [mypy_primer](https://github.com/hauntsaninja/mypy_primer), showing the effect of this PR on open source code:\n```diff\n' + data + '```'
})
}
} catch (error) {
console.log(error)
}