Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
refactor review comment posting (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
harjotgill authored Apr 19, 2023
1 parent b73fb59 commit 8930f9f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 43 deletions.
34 changes: 12 additions & 22 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 14 additions & 21 deletions src/commenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,29 +184,22 @@ ${COMMENT_TAG}`
core.info(
`Creating new review comment for ${comment.path}:${comment.start_line}-${comment.end_line}: ${comment.message}`
)
const commentData: any = {
owner: repo.owner,
repo: repo.repo,
pull_number,
commit_id,
body: comment.message,
path: comment.path,
line: comment.end_line
}

if (comment.start_line !== comment.end_line) {
await octokit.pulls.createReviewComment({
owner: repo.owner,
repo: repo.repo,
pull_number,
commit_id,
body: comment.message,
path: comment.path,
line: comment.end_line,
start_side: 'RIGHT',
start_line: comment.start_line
})
} else {
await octokit.pulls.createReviewComment({
owner: repo.owner,
repo: repo.repo,
pull_number,
commit_id,
body: comment.message,
path: comment.path,
line: comment.end_line
})
commentData.start_side = 'RIGHT'
commentData.start_line = comment.start_line
}

await octokit.pulls.createReviewComment(commentData)
}

commentCounter++
Expand Down

0 comments on commit 8930f9f

Please sign in to comment.