Skip to content

Commit

Permalink
add debug statement
Browse files Browse the repository at this point in the history
  • Loading branch information
gmaclennan committed Oct 22, 2024
1 parent 455993e commit 5afe986
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

33 changes: 18 additions & 15 deletions src/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@ const { createTable, createSummary } = require('./comment')
const packageLockParser = new PackageLockParser()

const getCommentId = async (octokit, oktokitParams, issueNumber, commentHeader) => {
const currentComments = await octokit.rest.issues.listComments({
...oktokitParams,
issue_number: issueNumber,
per_page: 100,
})
const actionUser = await octokit.rest.users.getAuthenticated();

if (!currentComments || !currentComments.data) {
throw Error('💥 Cannot fetch PR comments data, aborting!')
}
try {
const currentComments = await octokit.rest.issues.listComments({
...oktokitParams,
issue_number: issueNumber,
per_page: 100,
})
const actionUser = await octokit.rest.users.getAuthenticated()

return currentComments.data
.filter(
({ user, body }) => user.login === actionUser.login && body.startsWith(commentHeader)
)
.map(({ id }) => id)[0]
if (!currentComments || !currentComments.data) {
throw Error('💥 Cannot fetch PR comments data, aborting!')
}

return currentComments.data
.filter(({ user, body }) => user.login === actionUser.login && body.startsWith(commentHeader))
.map(({ id }) => id)[0]
} catch (e) {
console.error(e)
throw e
}
}

const getBasePathFromInput = (input) =>
Expand Down

0 comments on commit 5afe986

Please sign in to comment.