From 43be8544cbddf02c91c51e4c7b684577bcf96c1c Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Tue, 2 Aug 2022 23:01:07 +0000 Subject: [PATCH] fix new issue bot --- action.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/action.js b/action.js index 38b3b77..87838be 100755 --- a/action.js +++ b/action.js @@ -59,9 +59,12 @@ if (isComment) { author = payload.issue.user.login; } const quoteArray = []; +const noQuoteArray = []; for (const line of titleAndBody.split('\n')) { // Remove some speical chars to remove at mention spam possibilities. - quoteArray.push('> ' + line.replace(/[@#]/g, "")); + const l = line.replace(/[@#]/g, "") + quoteArray.push('> ' + l); + noQuoteArray.push(l); } const replyBody = `Hi @${author}, @@ -170,12 +173,12 @@ try { body: replyBody, }); if (isComment) { - const title = (`@${author}: ` + replyBody.replaceAll('\n', ' ')).substring(0, 255) + const title = (`@${author}: ` + quoteArray.join('\n').replaceAll('\n', ' ')).substring(0, 255) const new_issue = octokit.issues.create({ owner: payload.repository.owner.login, repo: payload.repository.name, title, - body: replyBody, + body: payload.comment.html_url + '\n\n' + replyBody, }) } else { // Update labels.