From e033a1d4b56eb9ac318199d4e40aa1a31cd5ab33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Caras?= Date: Tue, 30 Jul 2024 17:44:52 +0200 Subject: [PATCH] fix: check for correct bot login --- dist/index.js | 6 +----- src/index.ts | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index f088362..593ea50 100644 --- a/dist/index.js +++ b/dist/index.js @@ -45402,18 +45402,14 @@ try { mediaType: { format: "html" } - })).data.filter((i) => i.user?.type === "Bot"); - console.log(comment2[0].user?.login); + })).data.filter((i) => i.user?.type === "Bot" && i.user.login === "github-actions[bot]"); if (comment2.length === 0) break; - console.log(comment2.length); - console.log(comment2[0].body_html); const taskId2 = /https:\/\/app.freelo.io\/task\/(\d+)/.exec(comment2[0].body_html ?? ""); if (!taskId2 || taskId2.length === 0) { console.log("Comment found, but no Freelo task ID identified"); break; } - console.log(`${apiEndpoint}/task/${taskId2[1]}/finish`); const res = await axios_default.post(`${apiEndpoint}/task/${taskId2[1]}/finish`, null, defaultOptions); if (res.status > 399) { console.error(res.data); diff --git a/src/index.ts b/src/index.ts index a541d2a..eddb2b9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -133,12 +133,9 @@ try { }, }) ).data.filter( - (i) => i.user?.type === "Bot", + (i) => i.user?.type === "Bot" && i.user.login === "github-actions[bot]", ); - console.log(comment[0].user?.login) if (comment.length === 0) break; // not a Freelo task, skip - console.log(comment.length); - console.log(comment[0].body_html); // Finish task in Freelo const taskId = /https:\/\/app.freelo.io\/task\/(\d+)/.exec( @@ -148,7 +145,6 @@ try { console.log("Comment found, but no Freelo task ID identified"); break; } - console.log(`${apiEndpoint}/task/${taskId[1]}/finish`) const res = await axios.post( `${apiEndpoint}/task/${taskId[1]}/finish`, null,