Skip to content

Commit

Permalink
Update send-metrics.mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunridge authored Dec 18, 2023
1 parent ca313e6 commit 9d55f4c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions roiScript/send-metrics.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ const fetchCommentsJSON = async (commentsUrlStr) => {
}
}

function extractNumberFromComment(commentBody) {
const match = commentBody.match(/Time from assignment to PR for #\d+: (\d+) seconds/);
return match ? parseInt(match[1]) : null;
}

const commentsArr = await fetchCommentsJSON(commentsUrl)
const targetComment = commentsArr?.find(comment => comment.body.startsWith("Time from assignment to PR for"))
console.log('targetComment.body: ', targetComment.body);
const durationValue = extractNumberFromComment(targetComment)
console.log('durationValue', durationValue)

const databaseId = NOTION_DATABASE_ID

Expand Down

0 comments on commit 9d55f4c

Please sign in to comment.