Skip to content

Commit

Permalink
Try a different API.
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban committed Nov 6, 2022
1 parent 7bb88f4 commit f41363d
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions .github/scripts/pr_comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,29 +90,26 @@ module.exports = async ({github, context, process, retry_delay}) => {
// Prepare inline comments.
var comments = []
Object.keys(report.src_stats).forEach((path) => {
report.src_stats[path].violation_lines.forEach((position) => {
report.src_stats[path].violation_lines.forEach((line) => {
comments.push({
path,
position,
body: 'Missing coverage.'
line,
})
})
})

if (!comments) {
// Coverage is complete. Nothing to comment about.
return
}

await octokit.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
commit_id: context.payload.after,
pull_number: context.payload.number,
event: "COMMENT",
body: "Missing coverage report." + comment_marker,
comments
comments.forEach(async (comment) => {
octokit.rest.pulls.createReviewComment({
owner: context.repo.owner,
repo: context.repo.repo,
commit_id: context.payload.after,
pull_number: context.payload.number,
body: 'Missing coverage.',
path: comment.path,
line: comment.line,
});
})

}

/*
Expand Down

0 comments on commit f41363d

Please sign in to comment.