Skip to content

Commit

Permalink
tolerate failure to post comment in PRs from forks
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
  • Loading branch information
jsoref committed Mar 8, 2024
1 parent 71a566e commit 086ac01
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/coverage.yaml
Expand Up @@ -64,11 +64,15 @@ jobs:
const report = `### Coverage report
**Main**: ${main.toFixed(2)}% | **PR**: ${pr.toFixed(2)}% | **Diff: ${diff.toFixed(2)} ${diff >= 0 ? '✅' : '⚠️'}**`;
if (context.issue.number) {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: report
})
try {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: report
})
} catch (e) {
console.log("This happens when a PR from a fork triggers a workflow", e)
}
}
await core.summary.addRaw(report).write()

0 comments on commit 086ac01

Please sign in to comment.