generated from im-open/javascript-action-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARCH-2011 - Adding tests for PR comments
- Loading branch information
1 parent
a924fe7
commit b316dff
Showing
9 changed files
with
4,600 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = async (github, core, commentId) => { | ||
core.info(`\nAsserting that PR Comment with the following id exists: '${commentId}'`); | ||
|
||
let actualComment; | ||
|
||
if (!commentId || commentId.trim() === '') { | ||
core.setFailed(`The comment id provided was empty.`); | ||
} | ||
|
||
const commentResponse = await github.rest.issues.getComment({ | ||
owner: 'im-open', | ||
repo: 'process-dotnet-test-results', | ||
comment_id: commentId.trim() | ||
}); | ||
|
||
if (!commentResponse && !commentResponse.data) { | ||
core.setFailed(`Comment ${commentId} does not appear to exist.`); | ||
} else { | ||
core.info(`Comment ${commentId} exists.`); | ||
let rawComment = commentResponse.data; | ||
|
||
actualComment = { | ||
id: rawComment.id, | ||
body: rawComment.body, | ||
createdAt: rawComment.created_at, | ||
updatedAt: rawComment.updated_at, | ||
issueUrl: rawComment.issue_url | ||
}; | ||
core.info(`Comment ${actualComment.id} details:`); | ||
console.log(actualComment); | ||
} | ||
|
||
return actualComment; | ||
}; |
Oops, something went wrong.