diff --git a/.github/actions/trivy-triage/helpers.js b/.github/actions/trivy-triage/helpers.js index 121d5b38ffaa..3b477dfad5a6 100644 --- a/.github/actions/trivy-triage/helpers.js +++ b/.github/actions/trivy-triage/helpers.js @@ -5,7 +5,8 @@ module.exports = { const category = discussion.category.name; const body = discussion.body; if (category !== "Ideas") { - consolt.log("skipping discussion with category ${category} and body ${body}"); + console.log(`skipping discussion with category ${category} and body ${body}`); + return []; } const scannerPattern = /### Scanner\n\n(.+)/; const scannerFound = body.match(scannerPattern); diff --git a/.github/actions/trivy-triage/helpers.test.js b/.github/actions/trivy-triage/helpers.test.js index 3ef2ef810124..7db708bcfd3f 100644 --- a/.github/actions/trivy-triage/helpers.test.js +++ b/.github/actions/trivy-triage/helpers.test.js @@ -73,5 +73,15 @@ describe('trivy-triage', async function() { assert(!labels.includes('FilesystemLabel')); assert(!labels.includes('MisconfigurationLabel')); }); + it('process only relevant categories', async function() { + const discussion = { + body: 'hello world', + category: { + name: 'Announcements' + } + }; + const labels = detectDiscussionLabels(discussion, configDiscussionLabels); + assert(labels.length === 0); + }); }); });