Skip to content

Commit

Permalink
Replace console.log with core.info
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjfno1 committed Oct 5, 2021
1 parent ff81408 commit 373a128
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/index.js
Expand Up @@ -12,25 +12,25 @@ async function main() {
const baseFile = core.getInput("lcov-base")
const updateComment = core.getBooleanInput("update-comment")

console.log("=============================")
console.log("UPDATE COMMENT", updateComment)
console.log("=============================")
core.info("=============================")
core.info("UPDATE COMMENT", updateComment)
core.info("=============================")

const raw = await fs.readFile(lcovFile, "utf-8").catch(err => null)
if (!raw) {
console.log(`No coverage report found at '${lcovFile}', exiting...`)
core.info(`No coverage report found at '${lcovFile}', exiting...`)
return
}

const baseRaw =
baseFile && (await fs.readFile(baseFile, "utf-8").catch(err => null))
if (baseFile && !baseRaw) {
console.log(`No coverage report found at '${baseFile}', ignoring...`)
core.info(`No coverage report found at '${baseFile}', ignoring...`)
}

const isPullRequest = Boolean(context.payload.pull_request)
if (!isPullRequest) {
console.log("Not a pull request, skipping...")
core.info("Not a pull request, skipping...")
return
}

Expand All @@ -50,9 +50,9 @@ async function main() {
const githubClient = new GitHub(token)

const createGitHubComment = () => {
console.log("=============================")
console.log("CREATE GITHUB COMMENT")
console.log("=============================")
core.info("=============================")
core.info("CREATE GITHUB COMMENT")
core.info("=============================")

return githubClient.issues.createComment({
repo: context.repo.repo,
Expand All @@ -63,9 +63,9 @@ async function main() {
}

const updateGitHubComment = commentId => {
console.log("=============================")
console.log("UPDATE GITHUB COMMENT")
console.log("=============================")
core.info("=============================")
core.info("UPDATE GITHUB COMMENT")
core.info("=============================")

return githubClient.issues.updateComment({
repo: context.repo.repo,
Expand All @@ -76,9 +76,9 @@ async function main() {
}

if (updateComment) {
console.log("=============================")
console.log("UPDATE COMMENT TRUE")
console.log("=============================")
core.info("=============================")
core.info("UPDATE COMMENT TRUE")
core.info("=============================")

const issueComments = await githubClient.issues.listComments({
repo: context.repo.repo,
Expand All @@ -91,23 +91,23 @@ async function main() {
)

if (existingComment) {
console.log("=============================")
console.log("HAS EXISTING COMMENT")
console.log("=============================")
core.info("=============================")
core.info("HAS EXISTING COMMENT")
core.info("=============================")

await updateGitHubComment(existingComment.id)
return
}
}

console.log("=============================")
console.log("CREATING COMMENT")
console.log("=============================")
core.info("=============================")
core.info("CREATING COMMENT")
core.info("=============================")

await createGitHubComment()
}

export default main().catch(function(err) {
console.log(err)
core.info(err)
core.setFailed(err.message)
})

0 comments on commit 373a128

Please sign in to comment.