From 1f804316d1894e13a1db51f1a85c7655ce345c13 Mon Sep 17 00:00:00 2001 From: arctic_hen7 Date: Sun, 9 Jan 2022 10:48:13 +1100 Subject: [PATCH] fix: made label extraction system more resilient --- dist/index.js | 6 +++--- src/app.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index 83b06e1..e058646 100644 --- a/dist/index.js +++ b/dist/index.js @@ -90814,12 +90814,12 @@ const newIssueHandler = async (ctx) => { const getRequestedLabels = (issueBody) => { // The relevant `
` block in a Tribble-formatted issue will always come at the end // We add to this because we need to get the actual contained text - const detailsOpenIdx = issueBody.lastIndexOf("
\nTribble internal data") + 51; + const detailsOpenIdx = issueBody.lastIndexOf("") + 10; const detailsCloseIdx = issueBody.lastIndexOf("
"); console.log(detailsOpenIdx); console.log(detailsCloseIdx); - // The indexing will return `-1` if it found nothing (but one had 51 added) - if (detailsOpenIdx === 50 || detailsCloseIdx === -1) { + // The indexing will return `-1` if it found nothing (but one had 10 added) + if (detailsOpenIdx === 9 || detailsCloseIdx === -1) { return undefined; } const encoded = issueBody.substring(detailsOpenIdx, detailsCloseIdx).trim(); diff --git a/src/app.js b/src/app.js index f155325..5540f61 100644 --- a/src/app.js +++ b/src/app.js @@ -31,12 +31,12 @@ const newIssueHandler = async (ctx) => { const getRequestedLabels = (issueBody) => { // The relevant `
` block in a Tribble-formatted issue will always come at the end // We add to this because we need to get the actual contained text - const detailsOpenIdx = issueBody.lastIndexOf("
\nTribble internal data") + 51; + const detailsOpenIdx = issueBody.lastIndexOf("") + 10; const detailsCloseIdx = issueBody.lastIndexOf("
"); console.log(detailsOpenIdx); console.log(detailsCloseIdx); - // The indexing will return `-1` if it found nothing (but one had 51 added) - if (detailsOpenIdx === 50 || detailsCloseIdx === -1) { + // The indexing will return `-1` if it found nothing (but one had 10 added) + if (detailsOpenIdx === 9 || detailsCloseIdx === -1) { return undefined; } const encoded = issueBody.substring(detailsOpenIdx, detailsCloseIdx).trim();